1.0.0 • Published 5 years ago

recursive-mustache v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

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