File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -264,12 +264,29 @@ module.exports = {
264264 new CssMinimizerPlugin ({
265265 minimizerOptions: [
266266 {}, // Options for the first function (CssMinimizerPlugin.cssnanoMinify)
267- {}, // Options for the second function (CssMinimizerPlugin.cleanCssMinify)
267+ {}, // Options for the second function
268268 {}, // Options for the third function
269269 ],
270270 minify: [
271271 CssMinimizerPlugin .cssnanoMinify ,
272- CssMinimizerPlugin .cleanCssMinify ,
272+ async (data , inputMap ) => {
273+ // eslint-disable-next-line global-require
274+ const CleanCSS = require (' clean-css' );
275+
276+ const [[filename , input ]] = Object .entries (data);
277+ const minifiedCss = await new CleanCSS ({ sourceMap: true }).minify ({
278+ [filename]: {
279+ styles: input,
280+ sourceMap: inputMap,
281+ },
282+ });
283+
284+ return {
285+ code: minifiedCss .styles ,
286+ map: minifiedCss .sourceMap .toJSON (),
287+ warnings: minifiedCss .warnings ,
288+ };
289+ },
273290 async (data , inputMap , minimizerOptions ) => {
274291 // To do something
275292 return {
You can’t perform that action at this time.
0 commit comments