Registry / devops / cssnano-paras20xx

cssnano-paras20xx

JSON →
library3.7.3-patch2jsnpmunverified

A modular CSS minifier built on top of PostCSS, version 3.7.3 (patch2). It uses small PostCSS plugins to perform advanced optimizations like custom identifier reduction, z-index rebasing, and adjacent selector merging. Released frequently alongside PostCSS updates. Differentiates from simpler minifiers (e.g., csso, clean-css) by leveraging the PostCSS ecosystem for extensibility and modularity.

npm install cssnano-paras20xx
INSTALL
IMPORT
SIG · CSSNANO-PARAS20XX
C
cssnano-paras20xx
devopsjavascriptv3.7.3-patch2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cssnano
import cssnano from 'cssnano'
const cssnano = require('cssnano').default
Default export in ESM; CommonJS requires '.default' if using named export incorrectly.
cssnano (as PostCSS plugin)
postcss([ cssnano() ])
postcss().use(cssnano)
cssnano is a function that returns a plugin, not a plugin object itself.
Options with safe mode
cssnano({ safe: true })
cssnano({ options: { safe: true } })
Options are passed directly to the cssnano function, not nested.

Demonstrates using cssnano as a PostCSS plugin with safe mode enabled to avoid aggressive optimizations.

import postcss from 'postcss'; import cssnano from 'cssnano'; const input = 'h1 { color: red; color: blue; }'; const result = await postcss([ cssnano({ safe: true }) ]).process(input, { from: undefined }); console.log(result.css); // 'h1{color:blue}'
Debug
Known issues
breakingOptions object structure changed – previously `options` wrapper, now flat.
fix
Use `cssnano({ safe: true })` instead of `cssnano({ options: { safe: true } })`.
affects: <3.0
deprecated`options.safe` is deprecated and will be removed in version 4; use `cssnano({ preset: 'safe' })` or configure directly.
fix
Use `cssnano({ preset: 'safe' })` or set specific options.
affects: >=3.0 <4
gotchacssnano modifies `z-index` values globally, which can break stacking contexts when used on partial CSS.
fix
Use `cssnano({ zindex: false })` to disable z-index rebasing.
affects: >=2.0
gotchaAggressive optimizations (default) may merge or remove CSS that appears redundant but is semantically meaningful.
fix
Enable safe mode or explicitly disable individual optimizations.
affects: >=2.0 <4
breakingcssnano v4 changes default presets and removes many options; migration required.
fix
Consult migration guide; use `cssnano({ preset: 'default' })` and review breaking changes.
affects: >=4.0
Errors
Common errors & fixes
TypeError: cssnano is not a function
Importing cssnano as a default export but using it incorrectly (e.g., without calling it).
fix
Ensure you call cssnano() to get the plugin: `postcss([ cssnano() ])`.
Options were removed in cssnano 4.0. Use presets instead.
Using old options like `safe` or `zindex` directly in v4.
fix
Use `cssnano({ preset: 'safe' })` or configure via `preset`.
Cannot find module 'cssnano'
cssnano is not installed or the import path is wrong.
fix
Run `npm install cssnano --save-dev` and import using `import cssnano from 'cssnano'`.
Upgrade
Version history
3.7.3-patch2latest on npm
Audit
Dependencies
postcssrequiredCore dependency – cssnano runs as a PostCSS plugin
Agent activity
4 hits · last 30 days
node
4
Resources
cssnano-paras20xx — npm install cssnano-paras20xx · libregistry