README.md

# rebar3_nine

Rebar3 compiler plugin for compiling nine routers.

## Build

    rebar3 compile

## Usage

Add this to your rebar.config:

    {project_plugins, [rebar3_nine]}.

    {provider_hooks, [{post, [{compile, {nine, compile}}]}]}.

This compilation step must happen after the other modules are compiled because it will depend on a function defined in the source code.

Assuming there is a function like this in the module `example`:

    compile_router(DirPath) ->
        nine:compile(#{
            routes => Routes,
            router => example_router,
            generator => nine_cowboy
        }, DirPath).

Then add this to rebar.config:

    {nine, [{callback, {example, compile_router}}]}.

The plugin will use this option to call `example:compile_router/1` to generate the router module .beam file in the proper ebin directory.

When `rebar3 compile` is run the nine compilation step will run automatically.

## License

Apache 2.0