Comps template loader for webpack.
npm install comps-loader --save-dev
Using with webpack:
loaders:[{
test: /\.tpl$/,
loader: 'comps-loader'
}]
Set component path resolver:
var compsLoader = require('comps-loader')
compsLoader.resolve(function (name) {
return path.join('/path/to/components', name, name, '.tpl')
})
- Param: comps
<Function>
Comps module.
Custom Comps module instance, if has more than one Comps instance, default require("comps")
.
- Param: resolver
<Function>
Define resolve method use to get component's file path by name, which receiving a "name" argument.
Syntax sugar for webpack-loader with query. It replace require(./a.tpl??pagelet=b)
with require(comps?pagelet=b!./a.tpl)
?? is the seperator<String>
param, and the test<RegExp>
param is using to filtrate unmatch files. loader for set custom loader, default "comps-loader
"