Mustache loader for webpack
Compiles Mustache templates with Hogan and optionally html-minifier.
$ npm i -S mustache-loader
module: {
loaders: [ {
test: /\.html$/,
loader: 'mustache'
// loader: 'mustache?minify'
// loader: 'mustache?{ minify: { removeComments: false } }'
// loader: 'mustache?noShortcut'
} ]
}
var template = require('./template.html');
var html = template({ foo: 'bar' });
If noShortcut
is passed, then Hogan compiled template is returned instead, so
you can pass it as partial.
var template = require('./template.html');
var template2 = require('./template2.html');
var html = template({ foo: 'bar' }, {partial: template2});