Skip to content
WebPack 2+ plugin for CSS minification after ExtractTextPluging
JavaScript CSS HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.eslintrc.json
.gitignore
.travis.yml
LICENSE
README.md
index.js
package-lock.json
package.json
postcss.config.js

README.md

optimize-cssnano-plugin Build Status

It will search for CSS assets during the Webpack build and minimize it with cssnano. Solves extract-text-webpack-plugin CSS duplication problem.

Just like optimize-css-assets-webpack-plugin but more accurate with source maps.

Installation:

Using npm:

npm install --save-dev @intervolga/optimize-cssnano-plugin

Configuration:

const OptimizeCssnanoPlugin = require('@intervolga/optimize-cssnano-plugin');

module.exports = {
  module: {
    loaders: [
      {
        test: /\.css$/,
        loader: ExtractTextPlugin.extract("style-loader", "css-loader")
      }
    ]
  },
  plugins: [
    new ExtractTextPlugin("styles.css"),

    new OptimizeCssnanoPlugin({
      sourceMap: nextSourceMap,
      cssnanoOptions: {
        preset: ['default', {
          discardComments: {
            removeAll: true,
          },
        }],
      },
    }),
  ]
}
You can’t perform that action at this time.