blueimp template loader for webpack. Compile templates and allows minification
npm install blueimp-tmpl blueimp-tmpl-loader --save-dev
var template = require("blueimp-tmpl!./file.html");
// => returns the template function compiled with the tmpl templating engine.
// And then use it somewhere in your code
template(data) // Pass object with data
Alternatively you can also define blueimp-tmpl in your webpack.config file:
{
module: {
loaders: [
{ test: "\.tpl.html$", loader: "blueimp-tmpl" },
]}
}
var template = require('./file.tpl.html');
The blueimp-tmpl loader allows you to minify the html before compiling by setting a loader query string
{
module: {
loaders: [
{ test: "\.tpl.html$", loader: "html-tpl?minimize=true" }
]
}
Run unit tests:
npm install
npm test