art-template loader for webpack
npm install art-template
npm install art-template-loader --save-devmodule.exports = {
// ...
module: {
rules: [
{
test: /\.art$/,
loader: "art-template-loader",
options: {
// art-template options (if necessary)
imports: require.resolve('./template-imports'),
compressor: source => {
return source
// remove newline / carriage return
.replace(/\n/g, "")
// remove whitespace (space and tabs) before tags
.replace(/[\t ]+\</g, "<")
// remove whitespace between tags
.replace(/\>[\t ]+\</g, "><")
// remove whitespace after tags
.replace(/\>[\t ]+$/g, ">")
// remove comments
.replace(/<!--[\w\W]*?-->/g, "");
}
}
},
],
},
// ...
}You can pass art-template options using standard webpack loader options.