recursive-mustache
v1.0.0
Published
Give a template and it will replace all partials with its template.
Downloads
1
Readme
What is it?
Don't worry about partials anymore. Just give the first argument the name of the template that you want to use and any partials found...example: {{> foobar}}, assuming the file foobar.mustache exists in the template directory, will be read in.
Arguments
First argument is the name of the template you want to start in. Second argument is the data that you want to pass to those templates.
You can change the template file extension by using templatesExtension = '.html'
;
You can change the template directory by using templates.templatesPath = './mydir/templates/';
.
Example
const templates = require('recursive-mustache');
templates.templatesPath = './templates/'; // optional - defaults to ./templates
templates.build('frontpage', {navname: 'frontpage'}).then((template) => {
console.log(template);
});
Tests
sudo docker run --rm -v $PWD:$PWD -w $PWD node:8.10 npm test