1 June 2017

You can minify css with optimize-css-assets-webpack-plugin, but by default some comments are left untouched. If you want to remove all comments you have to use an option for the cssnano, that is used as default for the compression of css.

Source code viewer
  1. // npm install --save-dev optimize-css-assets-webpack-plugin
  2. const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
  3.  
  4. module.exports = {
  5. plugins: [
  6. new OptimizeCssAssetsPlugin({
  7. cssProcessorOptions: {
  8. safe: true,
  9. discardComments: {
  10. removeAll: true,
  11. },
  12. },
  13. }),
  14. ]
  15. }
Programming Language: ECMAScript