ministache
Mustache templating with a focus on a slim size (~500 bytes gzipped). Useful for embedding into frontend libraries. ministache complies with most mustache specs with a few exceptions.
API
See the mustache(5) man page for an overview of features.
var compile = require('ministache');
var template = "Greetings, {{name}}";
var tpl = compile(template);
tpl({ name: "John Constantine" })
=> "Greetings, John Constantine"
Available via npm install ministache
Why?
ministache is ideal for use in embedding in other redistributable frontend libraries.
- Small: Only <1kb gzipped.
- Standard: Compliant with almost all mustache specs (see below)
Why not?
There are some mustache features that were dropped to achieve its minimal size.
- It's only about 40% the speed of mustache.js.
- Does not support whitespace collapsing. Not really an issue much for HTML, anyway.
- Does not support partials.
- Does not support set-delimiters (
{{=<% %>=}}
).
Also see
-
tj/minstache (
min
and notmini
), which isn't spec compliant and doesn't support contexts ({{#user}}{{name}}{{/}}
) -
janl/mustache.js, a fast and feature-filled solution that supports partials and such
Thanks
ministache © 2015+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).
ricostacruz.com · GitHub @rstacruz · Twitter @rstacruz