I'm interested in using dust.js, and I'd want to precompile the templates for efficiency reasons.
To automate the compilation process, I'd like to be able to do this from the command line. From the website, it seems that I'd have to use a browser to compile the templates. Is there a command line solution?
There is a way to automate the compilation process using the command line. First, you need to install dustjs-linkedin:
$ npm install -g dustjs-linkedin
Then you can use the command dustc
:
$ dustc input_file.tl output_file.js
You can also specify a name for the template by using the --name
flag:
$ dustc --name=dust_fun dust_is_fun.tl dust_is_fun.js
For more info, take a look at the Dust by LinkedIn GitHub page.
dustc
has been completely rewritten since version 2.6 of dustjs (however the syntax is almost identical), documentation is available here.