# npm
npm install @coco-platform/webpack-plugin-html-minify --only=dev;
# yarn
yarn add @coco-platform/webpack-plugin-html-minify --dev;
Please see https://github.com/kangax/html-minifier#options-quick-reference for complete options.
Then config the webpack:
const configuration = {
entry: path.resolve(__dirname, '__fixture__', 'index.js'),
resolve: {
extensions: ['.js', '.css'],
},
output: {
path: path.resolve(process.cwd(), 'dist'),
filename: '[name].js',
publicPath: '/',
},
module: {
rules: [],
},
plugins: [
Reflect.construct(HtmlWebpackPlugin, [
{
template: path.resolve(__dirname, '__fixture__', 'index.html'),
inject: 'body',
},
]),
Reflect.construct(HtmlMinifyPlugin, []),
],
};
MIT