A modular CSS minifier built on top of PostCSS, version 7.1.7. It optimizes CSS by removing whitespace, comments, duplicated rules, and applying transformations like merging rules, converting values, and minifying selectors. Release cadence is frequent with monthly patch releases. Key differentiators: modular design with presets (default, advanced, etc.), extensive plugin ecosystem, and deep PostCSS integration. Supports Node.js >=18.12.0, ships TypeScript declarations, and requires postcss@^8.5.10 as a peer dependency.
npm install cssnanoNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates using cssnano as a PostCSS plugin to minify CSS with the default preset.
Use import { defaultPreset } from 'cssnano' instead of require('cssnano/presets/default').Replace preset: 'safe' with preset: 'default' and adjust options if needed.
Always provide from: 'input.css' (or undefined) in the postcss options.
Upgrade Node.js to a supported version (18, 20, 22+).
Avoid relying on these plugins; use the main cssnano package without them.
Place cssnano last in the PostCSS plugins array.
Run 'npm install postcss@^8.5.10' to upgrade postcss.
Use const cssnano = require('cssnano').default; or switch to ESM import.Use import { defaultPreset } from 'cssnano'; instead.Use preset: 'default' instead.