rgl-tplmin-loader
v0.0.15
Published
regularjs`s text-template compress loader module for webpack
Downloads
1
Readme
rgl-tplmin-loader
A webpack loader for regularjs 's component-template file.
Neither <script> nor <style> will be resolved or parsed or minified in this loader
Just only minify the tpl file's content-text in a simple way, remove redundant code(the special chars like space, enter between tags).
no parse, no render. It is different from regular-loader , just string convert
Installation
npm install --save-dev rgl-tplmin-loader
Usage
Use the loader either via your webpack config
Via webpack config (recommended)
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.rgl$/, // or /\.html$/
use: 'rgl-tplmin-loader'
}
]
}
}
with happypack
module.exports = {
module: {
rules: [
{
test: /\.rgl$/, // or /\.html$/
use: 'happypack/loader?id=rglmin'
}
]
}
},
plugins: [
new HappyPack({
id: 'rglmin',
threadPool: happyThreadPool,
loaders: ['rgl-tplmin-loader?' + JSON.stringify({
minimize: true,
comments: {
html: false,
rgl: false
}
})]
})
]
In your application
import rgl from 'file.rgl';
CLI
webpack --module-bind 'rgl=rgl-tplmin'
In your application
import rgl from 'file.rgl';
Inline
In your application
import template from 'rgl-tplmin!./file.rgl';