0.2.0 • Published 6 years ago

@coco-platform/webpack-plugin-html-minify v0.2.0

Weekly downloads
8
License
MIT
Repository
github
Last release
6 years ago

@coco-platform/webpack-plugin-html-minify

Build Status Coverage Status Package Dependency Package DevDependency

Cooperate with html-webpack-plugin, take place build-in html minify, which make life cycle more clear.

Usage

# npm
npm install @coco-platform/webpack-plugin-html-minify --only=dev;
# yarn
yarn add @coco-platform/webpack-plugin-html-minify --dev;

Options

Please see https://github.com/kangax/html-minifier#options-quick-reference for complete options.

Example

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, []),
  ],
};

License

MIT