mustache-cache
v1.0.0
Published
Compile mustache templates into a requirable, callable function
Downloads
3
Readme
mustache-cache
Compile mustache templates into a requirable, callable function.
Installation
$ npm install -g mustache-cache
Usage
Usage: mustache-cache <template-file> [options]
Options:
-h, --help output usage information
-V, --version output the version number
-o, --outfile <file> Write cached template to this file. If unspecified, prints to stdout
Example
Given the file sayhi.tmpl
:
Hello {{name}}
To compile, run the following
$ mustache-cache sayhi.tmpl -o sayhi.tmpl.js
Using The Compiled Template
Require it like any local module file:
var sayhiTmpl = require('./sayhi.tmpl');
var rendered = sayhiTmpl({name: 'Jess'});
console.log(rendered);
Note: The compiled template requires mustache
to work. Ensure you have it
installed in your project with npm install --save mustache
Contributing
Pull Requests are welcome!
This is a truly open open source project: If your contributions are of a high quality, I will give you push permissions to make direct changes in the future.
Support Development
If you like this module, consider buying me a beer with Bitcoin: