unstale

npm / cssnano

cssnano

What changed in cssnano 4 to 9, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-26.

26 breaking2 security1 deprecations4 new APIs and options6 performance26 behavior and defaults3 tooling71 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

cssnano 974 changes

Breaking changes 13

  • Projects that require this package directly must declare it as a dependency or switch to the default preset configuration.

    9.9.0release notes

  • Overrides that pin an individual plugin no longer apply.

    9.9.0release notes

  • Resolutions that pin an individual plugin no longer apply.

    9.9.0release notes

  • The presets no longer run postcss-svgo; run it before cssnano or optimize SVG assets with the SVGO cli instead.

    9.8.0release notes

  • The svgo option is now ignored, so it no longer configures SVG optimization through the preset.

    9.8.0release notes

  • Accepts an optional leading rounding strategy when ordering animations and transitions or folding shorthands, provided the strategy is separated by a comma.

    9.6.0release notes

  • Longhand merging now stops at nested rules and at-rules without blocks, preventing generated shorthands from overriding nested declarations.

    9.2.0release notes

  • A non-function remove option now fails with a TypeError.

    9.1.0release notes

  • Automatic lookup now checks only the current working directory, searching .cssnanorc.json and then cssnano.config.js; parent directories and other locations are no longer searched.

    9.0.0upgrade guide

  • The package is now ESM-only, and deep imports such as cssnano/src, cssnano/src/index.js, and cssnano-preset-default/src are no longer available.

    9.0.0upgrade guide

  • cssnano migrates to ESM, which may affect how developers load it.

    9.0.0release notes

  • cssnano 9.0 requires Node.js 22.22.3 or later in 22.x, 24.15.0 or later in 24.x, or 26.0 and later.

    9.0.0upgrade guide

  • When loading a preset fails, cssnano no longer retries with the cssnano-preset- prefix; it attempts only the name provided.

    9.0.0upgrade guide

Deprecations 1

  • An installed preset package takes precedence over the built-in preset and prints a one-time warning; pass the imported preset function to avoid it.

    9.9.0release notes

New APIs and options 2

  • Accepts Browserslist options for determining browser support when merging alignment properties.

    9.2.0release notes

  • A new postcss-calc plugin is introduced.

    9.0.0release notes

Performance 2

Behavior and default changes 21

  • Full preset names fall back to the built-in preset when the corresponding package is not installed.

    9.9.0release notes

  • Always converts between cm and mm, and converts q to cm or mm; q is never the output unit.

    9.8.0release notes

  • Merges at-rules separated by unrelated rules.

    9.7.0release notes

  • Drops a min-* or max-* already implied in another range in the same media query.

    9.7.0release notes

  • Merges row-gap/column-gap, overscroll-behavior-x/-y, flex-direction/flex-wrap, column-rule-* and equal overflow-x/-y into shorthands when every target supports them.

    9.6.0release notes

  • Minifies Unicode in CSS.

    9.5.0release notes

  • cssnano merges more overridden declarations.

    9.4.0release notes

  • cssnano now merges non-adjacent rules.

    9.3.0release notes

  • Merges compatible box alignment longhands into this shorthand only when every targeted browser supports it.

    9.2.0release notes

  • Its updated calculation behavior attempts to preserve fractions when a replacement would lose too much precision.

    9.2.0release notes

  • Writes numbers in scientific notation when shorter, including when length unit conversion is disabled; integers retain their form.

    9.2.0release notes

  • Merge margin, padding, border, border-radius, columns, and border-spacing declarations inside at-rule containers, and fold identical horizontal and vertical border-spacing components.

    9.1.0release notes

  • Four complete corner longhands in the same importance lane can merge into a shorthand, with horizontal and vertical axes minified independently.

    9.1.0release notes

  • Removes insignificant whitespace around custom-property names while preserving authored value whitespace, required token boundaries, empty fallback whitespace, and comments.

    9.1.0release notes

  • Duplicate keyframes and counter-style definitions are merged more conservatively.

    9.1.0release notes

  • Renames identifiers only when definitions and references are in the same stylesheet, and avoids renaming names in specified functions, fallbacks, or reserved words.

    9.1.0release notes

  • Uses deterministic shortest non-crossing canonical shorthands from complete side and component groups, while respecting importance lanes, cascade barriers, and partial grids.

    9.1.0release notes

  • Minifies equal components in two-axis, four-side, alignment, aspect-ratio, and transition declarations while preserving grammar-sensitive and invalid values.

    9.1.0release notes

  • Margin, padding, and physical border shorthand property names and case-insensitive keywords are canonicalized to lowercase while unmerged longhands and unresolved values retain author casing.

    9.1.0release notes

  • Follows WHATWG fragment handling, leaves non-conforming data URLs untouched, recognizes CSS hex escapes in schemes, and optimizes eligible SVG URLs while preserving modifiers and comments.

    9.1.0release notes

  • Configuration loading is simplified, with some changes documented in the migration guide.

    9.0.0release notes

Tooling 1

  • cssnano ships its presets and plugins in one package, reducing the dependency tree from about thirty packages to one.

    9.9.0release notes

Fixes and other changes 34

  • The lite and advanced presets work without installing another package.

    9.9.0release notes

  • Only the url() token is normalized; URLs remain byte-identical, and whitespace inside quoted @namespace URLs is preserved.

    9.8.0release notes

  • Improves escape handling in selectors.

    9.6.0release notes

  • Fixes merging of long selectors.

    9.3.2release notes

  • Improves handling of box-shadow and animation values.

    9.3.2release notes

  • Fixes a crash caused by depending on an unpublished version of cssnano-utils.

    9.3.1release notes

  • Avoids an infinite loop in postcss-merge-rules.

    9.2.2release notes

  • Removes redundant sibling at-rules during CSS optimization.

    9.2.1release notes

  • Shortens top center, bottom center, center top and center bottom to the corresponding single keyword.

    9.2.0release notes

  • Leaves positions unchanged when rewriting could be unsafe because of split background values, functions that may return keywords, or invalid three-value positions containing math functions.

    9.2.0release notes

  • Leaves the rule unchanged because browsers only recognize it with double quotes.

    9.2.0release notes

  • Only treats a dimension with a length unit as the font size, leaving invalid shorthand values unchanged.

    9.2.0release notes

  • Leaves the shorthand unchanged when it contains attr(), if(), inherit() or a custom function, whose results are only known at computation time.

    9.2.0release notes

  • Removes a zero stop position only when its type is valid for the gradient; conic gradients drop 0deg but retain invalid 0px.

    9.2.0release notes

  • Leaves rules with invalid selectors unchanged, including digit-leading ID selectors and combinators after pseudo-elements.

    9.2.0release notes

  • Rules with invalid selectors are no longer merged, avoiding invalid selector lists that cause browsers to drop otherwise valid rules.

    9.2.0release notes

  • Does not turn comments inside selectors into descendant combinators, and leaves invalid selectors as written.

    9.2.0release notes

  • Preserves strings when removing a line continuation after an escape would change how the escape is parsed.

    9.2.0release notes

  • Preserves to directions as written because the prefixed syntax measures angles differently.

    9.2.0release notes

  • Redundant whitespace in at-rules is now collapsed.

    9.1.2release notes

  • Preserves unicode ranges during value conversion.

    9.1.1release notes

  • Restricts color minification to color-accepting properties and custom properties, adds hwb() and nested-function support, and preserves custom identifiers and relative color syntax.

    9.1.0release notes

  • Recognizes count and math-function shorthands in either order, outputs auto 2 for 2 auto, and preserves zero lengths and invalid declarations.

    9.1.0release notes

  • Comment detection respects CSS token boundaries, kept comments remain byte-for-byte intact, per-document state is isolated, and the remove callback runs once per occurrence.

    9.1.0release notes

  • Preserves zero percentage units where required, respects disabled 0ms conversions, and clamps percentage opacity values according to CSS Color 4 alpha semantics.

    9.1.0release notes

  • Preserves units in @property, keyframes, font override descriptors, anchor(), flex-basis, and IE-targeted sizing properties, and preserves SVG stroke zero percentages.

    9.1.0release notes

  • Math-function recognition is standardized across value transforms; spacing around division is preserved, nested calculation commas are trimmed, and CSS Values 4 math functions are handled consistently.

    9.1.0release notes

  • URL normalization decodes quoted values, uses POSIX path semantics, preserves escapes and control-character quotes, and safely handles namespace URLs and multiline continuations.

    9.1.0release notes

  • Preserves percentage units in registered custom-property initial values with composite syntax, ranges, groups, and multipliers.

    9.1.0release notes

  • SVG decoding now follows the WHATWG specification.

    9.0.5release notes

  • Conflict detection and color conversion were updated for CSS spec conformance.

    9.0.3release notes

  • Adds the main field to package manifests.

    9.0.2release notes

  • Adds the types field to package manifests.

    9.0.2release notes

  • The calc() minifier was entirely rewritten and should support most cases that previously triggered console warnings.

    9.0.0upgrade guide

cssnano 827 changes

Breaking changes 3

  • Selector minification tightens :is() fold acceptance to a strict allowlist.

    8.0.1release notes

  • The declaration sorter moved to the advanced preset, so developers using it need that preset.

    8.0.0release notes

  • Support for Node.js 20 was dropped.

    8.0.0release notes

Security 1

  • Packages define an exports field in package.json, preventing newly added files from automatically becoming importable while preserving imports available in the previous release.

    8.0.3release notes

Performance 4

Behavior and default changes 1

  • Updates the initial properties handled by the plugin.

    8.0.3release notes

Tooling 2

  • Types have been regenerated with TypeScript 7.

    8.0.3release notes

  • Includes postcss-discard-overridden types in the package.

    8.0.2release notes

Fixes and other changes 16

  • Charset normalization is now idempotent, so applying it repeatedly does not change the result further.

    8.0.10release notes

  • Fixes gradient minification to use the spec algorithm.

    8.0.8release notes

  • Option types were tightened, helping developers use valid options.

    8.0.7release notes

  • Cascade layers are optimized better.

    8.0.7release notes

  • Improves longhand merging correctness, including cases found by a fuzzer.

    8.0.6release notes

  • Fixes invalid rule merging.

    8.0.6release notes

  • Uses webref data to perform merges.

    8.0.6release notes

  • Avoids breaking grid-template-areas.

    8.0.6release notes

  • Improves selector minification.

    8.0.6release notes

  • Fixes issues with border merging.

    8.0.5release notes

  • Fixes an encoding issue in postcss-svgo.

    8.0.4release notes

  • Preserves trailing slashes in URLs.

    8.0.3release notes

  • Preserves whitespace in custom properties.

    8.0.3release notes

  • Handles gradients with more than two stops.

    8.0.3release notes

  • Preserves apostrophes in SVG data URIs.

    8.0.2release notes

  • Selector minification no longer folds :is() when the divergent middle contains a combinator under a non-empty prefix.

    8.0.1release notes

cssnano 79 changes

Breaking changes 1

  • Drops support for Node.js 14, 16, 19, and 21, and adds support for Node.js 22.

    7.0.0release notes

New APIs and options 2

Behavior and default changes 1

Fixes and other changes 5

  • Rejects :is() folding for unknown pseudo-classes with arguments.

    7.1.9release notes

  • Rejects :is() folding for :nth-child(... of S) to preserve the cascade.

    7.1.8release notes

  • postcss-reduce-idents now supports the counter-set property.

    7.1.5release notes

  • Updates the color conversion library to fix rounding errors in color conversions.

    7.1.4release notes

  • Recognition of CSS comments was enhanced.

    7.1.2release notes

cssnano 63 changes

Breaking changes 3

  • The minimum supported Node version is now 14 for all packages.

    6.0.0release notes

  • Configuration options for the normalize-url transform were removed; turn the transform off completely if you do not want its defaults.

    6.0.0release notes

  • YAML configuration is no longer supported; move cssnano configuration into the PostCSS config or use a CommonJS or JSON configuration file.

    6.0.0release notes

cssnano 514 changes

Breaking changes 2

  • The JavaScript API changes from cssnano.process() to cssnano().process(), and cssnano options are passed to cssnano() instead of process().

    5.0.0release notes

  • cssnano 5 requires Node >= 10.13.

    5.0.0release notes

Security 1

  • Removes a vulnerable dependency and always warns with bad SVG input.

    5.0.0release notes

Behavior and default changes 1

  • cssnano uses the PostCSS 8 API and does not emit warnings when running under PostCSS 8.

    5.0.0release notes

Fixes and other changes 10

  • Fixes minification of aspect-ratio.

    5.0.0release notes

  • The updated parser fixes many bugs.

    5.0.0release notes

  • Fixes improperly discarded @font-face declarations.

    5.0.0release notes

  • Fixes sorting of longhand and shorthand properties.

    5.0.0release notes

  • Fixes minification of percentage values.

    5.0.0release notes

  • Partially fixes cases where cssnano did not combine rules when used with postcss-nested.

    5.0.0release notes

  • Fixes merging of @supports rules.

    5.0.0release notes

  • cssnano updates to SVGO 2, fixing many SVG minification bugs.

    5.0.0release notes

  • Fixes translate3d() minification.

    5.0.0release notes

  • Fixes minification of values starting with e.

    5.0.0release notes

cssnano 412 changes

Breaking changes 4

  • Support for Node 4 was dropped; Node 6.9 is now the minimum required version.

    4.0.0release notes

  • No longer removes all for IE.

    4.0.0release notes

  • Stops changing U to lowercase for IE 11 and earlier and Edge 15 and earlier.

    4.0.0release notes

  • No longer handles an empty url function.

    4.0.0release notes

Behavior and default changes 2

  • Adds whitespace after a minified value and before a function.

    4.0.0release notes

  • The optimizer now optimises the border-spacing property.

    4.0.0release notes

Fixes and other changes 6

  • Correctly handles border-style declarations with custom properties.

    4.0.0release notes

  • Correctly handles the :-ms-input-placeholder and ::-ms-input-placeholder selectors.

    4.0.0release notes

  • Correctly handles the all property.

    4.0.0release notes

  • More accurately escapes font names.

    4.0.0release notes

  • Correctly handles data and *-extension:// URLs.

    4.0.0release notes

  • Correctly handles the border property when its border width value is invalid.

    4.0.0release notes