Webpack loader that minifies HTML by html-minifier.
npm install html-minifier html-minifier-loader --save
You can pass html-minifier parameters by 'html-minifier-loader' property.
The default is {removeComments: true, collapseWhitespace: true}
.
module: {
loaders: [
{ test: /\.html$/,
loader: 'raw-loader!html-minifier-loader'
}
]
},
'html-minifier-loader': {
removeComments: false,
collapseWhitespace: true,
conservativeCollapse: true,
preserveLineBreaks: true
}