Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

html-minifier-loader

sapics3.1kMIT1.4.1

Webpack loader that minifies HTML by html-minifier

html-minifier, webpack, loader

readme

html-minifier-loader NPM version

Webpack loader that minifies HTML by html-minifier.

Installation

npm install html-minifier html-minifier-loader --save

Example of webpack.config.js

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
}