1.1.4 • Published 3 years ago
ivy-template-loader v1.1.4
ivy-template-loader
webpack template loader
模板预处理使用的是 lodash.template 机制
Installation
npm install ivy-template-loader
Usage
var template = require("index.tpl");
// => returns the template function compiled with template engine,like underscore (lodash).
// And then use it somewhere in your code
template(data) // Pass object with data
Config example using the ivy-template-loader
config block.
module.exports = {
rules: [
{
test: /\.tpl$/,
exclude: /node_modules/,
use: {
loader: 'ivy-template-loader',
options: {
minimize: true,
/* 可自定义 */
settings: {
evaluate: /{{([\s\S]+?)}}/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g
}
}
}
}
]
};