A node package that executes Handlebars precompiler commands whenever a change happens in the watched directories.
There are a couple of node packages that does the same thing and even more, but I noticed that most of them are implementing there own precompiler for Handlebars. I just wanted to use the existing Handlebars precompiler and trigger it by watching a folder structure.
The package may be installed via npm using the npm install -g handlebars-watch
command.
Options: -c, --config Path to Config File [string]
In CLI
handlebars-watch -c ../build/hbw-config.json
May need to use 'sudo' along with the command in the linux and mac OS.
Inside a node file
var hbw = require('handlebars-watch');
hbw.watchAndCompile('../build/hbw-config.json');
The config file is a simple json array and is required for this package. Each item in the array is a combination of a path and command. The path is the location of the folder to watch and command is the command to execute when the watch is triggered.
Eg.
[{
"path": "templates/pages/",
"command": "handlebars templates/pages>pageTemplates.js -a -e html"
},{
"path": "templates/partials/",
"command": "handlebars templates/partials>partialTemplates.js -a -p -e html"
}]
- The path should be relative to the location of the config file.
- Install Handlebars as a global package.
##Issues Or Contributions
- If you have an idea to improve the package, let me know. It will help the community.
- If this helped you, spread the word and don't forget to star the repo.
- Post issues in the github issue tracker.
- My email is [email protected]
- Pull requests are welcome.
- LinkedIn Pofile
- Stack Overflow Pofile