tpl-lite-loader
v0.1.0
Published
Underscore Templates loader for webpack
Downloads
2
Maintainers
Readme
感谢(Thanks)
感谢 tpl-loader给我的灵感
安装(Installation)
npm install tpl-lite-loader
使用(Usage)
- 直接在
require
方法上使用var template = require("tpl-lite!./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
- 在
webpack.config.js
使用module: { loaders: [{ test: /\.tpl$/, loader: "tpl-lite" }] }
你还可以自定义自己的template
配置, 比如
module: {
loaders: [{
test: /\.tpl$/,
loader: "tpl-lite"
tplSettings: {
escape: /\{\{([^{].*?)\}\}/gm,
interpolate: /\{\{\{(.+?)\}\}\}/gm,
evaluate: /\{\%(.+?)\%\}/g
}
}]
}
...
License
MIT (http://www.opensource.org/licenses/mit-license.php)