Erlang, Nitrogen and automatic rebuild.
Published by emacstheviking on Tue, 05/24/2011 - 23:21
We all know that by issuing this command:
bin/nitrogen attach sync:go(). <Ctrl+D>
that the framework will rebuild things as you edit them so that you can edit and refresh the page just as you would for any other web development language like PHP for example.
I wanted to be able to make it do this when the application starts for the first time and then turn it off when I release a project.
So, how do you do it... simples... just add the call into the "/site/src/nitrogen_app.erl" file like so:
-module(nitrogen_app). -behaviour(application). -export([start/2, stop/1]). %% =================================================================== %% Application callbacks %% =================================================================== start(_StartType, _StartArgs) -> nitrogen_sup:start_link(), io:format("***NOTICE*** sync.go() called in nitrogen_app.erl ***\n",), sync:go(). stop(_State) -> ok.
The next time you start the project with bin/nitrogen start you will be able to just edit away... if you have a log running like I do you will be able to see the changes picked up and the BEAM files getting generated.