@@ -481,11 +481,6 @@ module.exports = {
481
481
482
482
### Using custom minifier [ clean-css] ( https://github.com/jakubpawlowicz/clean-css )
483
483
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
-
489
484
** webpack.config.js**
490
485
491
486
``` js
@@ -495,24 +490,29 @@ module.exports = {
495
490
minimize: true ,
496
491
minimizer: [
497
492
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
+ ```
501
501
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 )
509
503
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 },
516
516
}),
517
517
],
518
518
},
0 commit comments