npm install template-parser --save
With this module you can use templates with handlebars to load data dynamically, imagine you have a help.hbs file and have a file with the same name help.json, you can use the data that you have stored in help.json and parse it into help.hbs
- project_folder
- templates
- hbs
- help.hbs
- json
- help.json
- hbs
- main.js
- package.json
help.json
{ "name" : "Joel" }
help.hbs
My name is : {{name}}
var template = require('template-parser');
var test = template.parse('help');
console.log(test);
var template = require('template-parser');
var test = template.parse('help', { template_dir : 'other' });
console.log(test);
var template = require('template-parser');
var test = template.parse('help', { hbs_dir : 'other' });
console.log(test);
var template = require('template-parser');
var test = template.parse('help', { json_dir : 'other' });
console.log(test);
All help are more than welcome!
- Fork this respository.
- Clone your fork and create a feature branch from develop. git clone git@github.com:/template-parser.git git fetch origin git checkout dev git checkout -b feature-<new_feature>
- Install development dependencies. npm install
- Code and be happy!
- Test your code using Mocha.
- Submit a pull request and thanks.
Questions? Hit me.
To run all tests:
npm test
template-parser was created by Joel A. Jaime for the world.