
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@intervolga/optimize-cssnano-plugin
Advanced tools
WebPack 2+ plugin for CSS minification after ExtractTextPluging
@intervolga/optimize-cssnano-plugin is a plugin for optimizing CSS assets using cssnano within a webpack build process. It helps in minimizing CSS files to reduce the overall bundle size, which can improve the performance of web applications.
Basic CSS Optimization
This feature allows you to optimize and minify CSS files using cssnano. The configuration includes options for source maps and cssnano presets to customize the optimization process.
const OptimizeCSSNanoPlugin = require('@intervolga/optimize-cssnano-plugin');
module.exports = {
// other webpack configuration
plugins: [
new OptimizeCSSNanoPlugin({
sourceMap: true,
cssnanoOptions: {
preset: ['default', {
discardComments: {
removeAll: true,
},
}],
},
}),
],
};
Custom CSS Optimization
This feature allows for more advanced customization of the CSS optimization process. You can use different cssnano presets and options to fine-tune the minification and optimization according to your needs.
const OptimizeCSSNanoPlugin = require('@intervolga/optimize-cssnano-plugin');
module.exports = {
// other webpack configuration
plugins: [
new OptimizeCSSNanoPlugin({
cssnanoOptions: {
preset: ['advanced', {
discardComments: {
removeAll: true,
},
reduceIdents: false,
}],
},
}),
],
};
css-minimizer-webpack-plugin is another popular plugin for optimizing and minimizing CSS assets in a webpack build. It uses cssnano under the hood but provides a more modern and flexible API compared to @intervolga/optimize-cssnano-plugin. It also supports parallel processing to speed up the build process.
mini-css-extract-plugin extracts CSS into separate files, creating a CSS file per JS file which contains CSS. It is often used in combination with cssnano for CSS optimization. While it focuses more on extracting CSS, it can be used alongside other plugins for optimization purposes.
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.
Using npm:
$ npm install --save-dev @intervolga/optimize-cssnano-plugin
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,
},
}],
},
}),
]
}
FAQs
WebPack 2+ plugin for CSS minification after ExtractTextPluging
The npm package @intervolga/optimize-cssnano-plugin receives a total of 248,526 weekly downloads. As such, @intervolga/optimize-cssnano-plugin popularity was classified as popular.
We found that @intervolga/optimize-cssnano-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.