Underscore Templates loader for webpack
npm install tpl-loaderLodash template loader for webpack. Uses _.template function to compile templates.
npm install tpl-loader
`` javascript
var template = require("tpl!./file.html");
// => returns the template function compiled with undesrcore (lodash) templating engine.
// And then use it somewhere in your code
template(data) // Pass object with data
`
You can add _.template settings as a tplSettings property inside webpack config file to specify options for the loader, for example:
` javascript``
...
tplSettings: {
escape: /\{\{([^{].*?)\}\}/gm,
interpolate: /\{\{\{(.+?)\}\}\}/gm,
evaluate: /\{\%(.+?)\%\}/g
}
...
MIT (http://www.opensource.org/licenses/mit-license.php)