cssnano-webpack-plugin weekly downloads statistics
By lneveu · npm · Webpack plugins
cssnano plugin for Webpack
cssnano-webpack-plugin has 310 recorded weekly downloads on npm, a decrease of 52.3% over the past 30 days, ranking #2378 of 3,247 tracked listings.
About cssnano-webpack-plugin
cssnano-webpack-plugin
This plugin uses cssnano to optimize and minify your CSS.
Fully integrated in Webpack ecosystem: based on compiler hooks, respecting default Webpack output sources and compatible with other plugins like SourceMapDevToolPlugin or webpack-subresource-integrity.
Just like optimize-css-assets-webpack-plugin but more accurate with source maps and assets using query string.
Works with Webpack 4+.
Getting Started
First, install cssnano-webpack-plugin:
$ npm install cssnano-webpack-plugin --save-dev
Then add the plugin to your webpack configuration. For example:
webpack.config.js
const CssnanoPlugin = require('cssnano-webpack-plugin');
module.exports = {
module: {
loaders: [
{
test: /.s?css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
}
]
},
optimization: {
minimizer: [
new CssnanoPlugin()
]
}
};
This will enable CSS optimization only in production mode. If you want to run it also in development, put the plugin configuration in the plugins option array.
Options
test
Type: String|RegExp|Array<String|RegExp> - default: /\.css(\?.*)?$/i
Test to match files against.
module.exports = {
optimization: {
minimizer: [
new CssnanoPlugin({
test: /\.foo\.css$/i
})
]
}
};
include and exclude options are also supported (see module rules).
sourceMap
Type: Boolean|Object - default: false
Enable (and configure) source map support. Use PostCss SourceMap options. Default configuration when enabled: { inline: false }.
module.exports = {
optimization: {
minimizer: [
new CssnanoPlugin({
sourceMap: true
})
]
}
};
cssnanoOptions
Type: Object - default: { preset: 'default' }
Cssnano optimisations options.
module.exports = {
optimization: {
minimizer: [
new CssnanoPlugin({
cssnanoOptions: {
preset: ['default', {
discardComments: { removeAll: true }
}]
}
})
]
}
};
Examples
Use sourcemaps
Don't forget to enable sourceMap options for all loaders.
const CssnanoPlugin = require('cssnano-webpack-plugin');
module.exports = {
module: {
loaders: [
{
test: /.s?css$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { sourceMap: true } },
{ loader: 'sass-loader', options: { sourceMap: true } }
]
}
]
},
optimization: {
minimizer: [
new CssnanoPlugin({
sourceMap: true
})
]
}
};
Remove all comments
Remove all comments (including comments starting with /*!).
module.exports = {
optimization: {
minimizer: [
new CssnanoPlugin({
cssnanoOptions: {
preset: ['default', {
discardComments: { removeAll: true }
}]
}
})
]
}
};
License
Description from the npm listing.
- cssnano
- css
- webpack
- webpack-plugin
- minimize
- minimizer
- minify
- minifier
- optimize
- optimizer
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (592)Similar npm Webpack plugins plugins
All 20 cssnano-webpack-plugin alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/cssnano-webpack-plugin. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.