Looking at the Handlebars.js documentation for precompilation.
The instructions are for OSX. Can this be done on Windows as well?
If so, when they say to "install node and npm" does "node" refer to "node.js"?
Precompiling Templates Inside NodeJS If you wish to precompile templates from inside NodeJS--without invoking "handlebars" from the command line--that can be done with Handlebars. precompile. Transmit the string result of this function to your clients, and they can in turn parse that with Handlebars. template.
Run in the command prompt:
npm install handlebars -g
Now you can use the following syntax in the command prompt:
handlebars <input> -f <output>
,where <input>
is an original template file name, and <output>
is a pre-compliled template file name.
Example:
handlebars person.hbr -f person.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With