You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Román Jiménez
a6fc752871
|
6 years ago | |
---|---|---|
.npmignore | 10 years ago | |
LICENSE | 10 years ago | |
README.md | 6 years ago | |
index.js | 8 years ago | |
package.json | 8 years ago |
README.md
Lodash template for webpack
Lodash template loader for webpack. Uses _.template
function to compile templates.
Installation
npm install tpl-loader
Usage
var template = require("tpl!./file.html");
// => returns the template function compiled with underscore (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:
...
tplSettings: {
escape: /\{\{([^{].*?)\}\}/gm,
interpolate: /\{\{\{(.+?)\}\}\}/gm,
evaluate: /\{\%(.+?)\%\}/g
}
...