@@ -481,11 +481,6 @@ module.exports = {
481481
482482### Using custom minifier [ clean-css] ( https://github.com/jakubpawlowicz/clean-css )
483483
484- By default plugin uses [ cssnano] ( https://github.com/cssnano/cssnano ) package.
485- It is possible to use another minify function.
486-
487- > ⚠️ ** Always use ` require ` inside ` minify ` function when ` parallel ` option enabled** .
488-
489484** webpack.config.js**
490485
491486``` js
@@ -495,24 +490,29 @@ module.exports = {
495490 minimize: true ,
496491 minimizer: [
497492 new CssMinimizerPlugin ({
498- minify: async (data , inputMap ) => {
499- // eslint-disable-next-line global-require
500- const CleanCSS = require (' clean-css' );
493+ minify: CssMinimizerPlugin .cleanCssMinify ,
494+ // Uncomment this line for options
495+ // minimizerOptions: { compatibility: 'ie11,-properties.merging' },
496+ }),
497+ ],
498+ },
499+ };
500+ ```
501501
502- const [[filename , input ]] = Object .entries (data);
503- const minifiedCss = await new CleanCSS ({ sourceMap: true }).minify ({
504- [filename]: {
505- styles: input,
506- sourceMap: inputMap,
507- },
508- });
502+ ### Using custom minifier [ csso] ( https://github.com/css/csso )
509503
510- return {
511- code: minifiedCss .styles ,
512- map: minifiedCss .sourceMap .toJSON (),
513- warnings: minifiedCss .warnings ,
514- };
515- },
504+ ** webpack.config.js**
505+
506+ ``` js
507+ module .exports = {
508+ devtool: ' source-map' ,
509+ optimization: {
510+ minimize: true ,
511+ minimizer: [
512+ new CssMinimizerPlugin ({
513+ minify: CssMinimizerPlugin .cssoMinify ,
514+ // Uncomment this line for options
515+ // minimizerOptions: { restructure: false },
516516 }),
517517 ],
518518 },
0 commit comments