Reputation: 16563
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?
Upvotes: 3
Views: 3935
Reputation: 5609
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.
Upvotes: 8
Reputation: 1867
There are several command line watchers that have been written to do this as well to automatically compile when a file changes. Here are a few:
All these do is automate the dustc command that smfoote has detailed.
Upvotes: 4