Change Log
10.0.1
Patch Changes
-
Improve error messages to facilitate migration
-
fix: update browser support data
10.0.0
Major Changes
-
feat(cssnano)!: cssnano no longer reads
envandstatsfrom the PostCSS process optionsWhen no preset sets them, the browser targets took
envandstatsfrom the options of the PostCSSprocess()call. They are now read only frombrowserslist.envandbrowserslist.stats, so the targets of a build are set in one place, the cssnano config. Pass them asbrowserslist: { env, stats }in the preset options. -
feat(cssnano)!: one options object for presets, plugins and browser targets
cssnano takes
preset,disable,optionsandbrowserslist, inline or in acssnano.config.jsmodule.presetis a function imported fromcssnano/presets/default,cssnano/presets/liteorcssnano/presets/advanced.disablelists transforms to leave out, andoptionsconfigures transforms, merged over their defaults. A transform is one optimization, and each transform is one PostCSS plugin.browserslistsets the browser targets for every plugin. A built preset is a list of PostCSS plugins, so other plugins are composed in the PostCSS configuration:import autoprefixer from 'autoprefixer'; import lite from 'cssnano/presets/lite'; export default { plugins: [autoprefixer(), ...lite({ disable: ['discardComments'] })] };Without a preset, the default preset runs, and
disableandoptionsname its plugins. Types follow the chosen preset:disableandoptionsaccept only that preset’s plugins.Inline options replace the configuration file, which is then not read,
browserslistincluded. An empty option sets nothing, so the file is still read.Removed and unknown keys throw, and the message says where the setting moved:
plugins,svgo, the browser target keysoverrideBrowserslist,env,statsandpath(see the preset-wide-browser-targets changeset), and a misspelled key. So does a transform name inoptionsordisablethat the chosen preset does not run, and a plugin name at the top level. A non-object passed tocssnano()throws. A known key with a value of the wrong type, a transform in bothdisableandoptions, or an unreadable configuration file throws, and the message names the key or the file.The configuration file is a JavaScript module with a default export; a module with only named exports throws. JSON files are not read: a
.cssnanorc.jsonin the working directory throws when cssnano looks for a configuration file (not withconfigFileor inline options), and aconfigFileending in.jsonthrows. Built-in presets with default options produce the same CSS as before this change.Before After preset: 'lite'preset: lite, imported fromcssnano/presets/lite.cssnanorc.jsonwith{ "preset": "lite" }cssnano.config.jswithimport lite from 'cssnano/presets/lite'; export default { preset: lite };preset: ['default', { colormin: false }]preset: defaultPreset, disable: ['colormin']{ colormin: { exclude: true } }disable: ['colormin']{ colormin: true },{ exclude: false }omit it ['default', { discardComments: { removeAll: true } }]preset: defaultPreset, options: { discardComments: { removeAll: true } }overrideBrowserslist(preset, plugin)browserslist: { query }env,stats(preset, plugin)browserslist: { env, stats }pathbrowserslist: { path }preset: lite()plugins: [...lite()]in the PostCSS configurationsvgo: falseomit it (throws) plugins: [...]add them to the PostCSS configuration (throws) disable: ['mergeLonghand'],disable: ['discardDuplicates']disable: ['merge'](also turns off rule merging)disable: ['mergeRules']options: { merge: { rules: false } } -
feat(cssnano)!: discardComments no longer has a
removeAllButFirstoption, so every comment marked as important (/*!) is kept unlessremoveAllorremoveasks for itImportant comments often carry license notices, which a bundle must keep for each library it includes. A configuration that still passes
removeAllButFirstnow keeps every important comment. -
feat(cssnano)!: drop browser workarounds for targets older than IE 11
Workarounds for IE 5.5 to 10, Firefox 2 and Opera 9 are removed, so output is written for IE 11 and newer. IE 11 keeps the zero-unit,
media allandunicode-rangeworkarounds, and@media \0screenis kept for every target.initialis no longer rewritten for targets without the initial keyword, such as IE 11, which ignores a declaration that uses it.min-width:initialstays as written forie 11.rgba(0,0,0,0)becomestransparentfor every known target. A query that matches no browser keepsrgba().Stylehacks is no longer a PostCSS plugin and is not part of the public package. postcss-merge-longhand still uses its detection functions, so it never merges hacked declarations.
A browser version that caniuse-lite does not list adds a PostCSS warning.
-
feat(cssnano): run the merge transforms as one
mergetransformmergeLonghand, discardDuplicates and mergeRules are now one transform,
merge, which runs in one PostCSS plugin,cssnano-merge, instead of three plugins that each walk the stylesheet. Longhand merging and duplicate removal always run together.options: { merge: { rules: false } }turns off rule merging, anddisable: ['merge']turns off all three. The transforms are otherwise unchanged, apart from the fixes listed in their own entries: property names are compared by ASCII case and decoded spelling, a statement at-rule is kept apart from a block at-rule,offset-*properties are compared with theinset-*properties they alias, a hacked declaration (_height,*zoom) is kept apart from its plain property, and a stale longhand fallback is dropped once a later shorthand overrides it. Code that filtersresult.messagesorpluginsby the old plugin names must usecssnano-merge. -
feat(cssnano)!: drop per-plugin browser target options
Browser targets are set once for every plugin, with
browserslist: { query, env, stats }. The plugins are no longer published separately, so every plugin judges a file against the same browsers.overrideBrowserslist,stats,envandpathgiven to one plugin, such asoptions: { colormin: { overrideBrowserslist: 'ie 11' } }, throw, because ignoring them would widen the targets. -
feat(cssnano)!: resolve one set of browser targets for every plugin, defaulting to Baseline widely available
Every plugin that depends on browser support reads one resolver, so the plugins of a preset judge a file against the same browsers. Targets come from
browserslist.query, then the project’s browserslist config orBROWSERSLIST, and otherwise frombaseline widely available on 2026-11-30 with downstream. Projects without a config previously got browserslist’sdefaults, and now get the Baseline targets, which allow more optimizations, such as merging alignment longhands intoplace-*shorthands. A query that matches no browser turns off every support-dependent optimization and adds a PostCSS warning.Output may stop working in browsers that
defaultsincludes but Baseline does not, such as Opera Mini, UC Browser, QQ Browser, KaiOS, Opera Mobile and Chrome 109. To keep the previous targets, add a browserslist config withdefaults, or passbrowserslist: { query: 'defaults' }.The default fixes the Baseline date at the release date, so a release produces the same output whenever it runs; a later release that moves the date can change it. Feature support still comes from the installed
caniuse-liteandbaseline-browser-mapping, so a lockfile pins the rest.Feature support is read from
caniuse-lite, which replacescaniuse-api. A feature that needs a vendor prefix, such as unprefixed:autofillfor chrome 8, counts as unsupported, and so does a target that caniuse-lite does not list. The browserslist config is searched from the PostCSSfromorfileoption, or the working directory when neither is set.browserslist.pathoverrides that search directory, andbrowserslist.confignames the config file to read. The browserslist optionsignoreUnknownVersions,mobileToDesktopandthrowOnMissingare forwarded, anddangerousExtendthrows. The top-levelpathoption is removed; usebrowserslist.path.The documentation site’s playground embeds the targets that the default query resolves at build time. It runs the same checks as the Node build, but ignores
browserslist.query. -
refactor(cssnano)!: a built-in preset returns one
cssnano-hostpluginThe default and lite presets no longer return one PostCSS plugin per option. Each returns one
cssnano-hostplugin that walks the stylesheet to run the value transforms, comment removal, whitespace cleanup, empty-node removal and merging. The advanced preset returns that host plugin, which also runsdiscardUnused,mergeIdents,reduceIdentsandzindex. A preset’s array therefore has fewer entries, and a host plugin is not the same object as the plugin it replaces. Option keys and their meaning are unchanged.Code that inspects a preset’s plugins by
postcssPluginname, or that expectspostcss-calc,postcss-convert-values,postcss-discard-emptyorpostcss-discard-unusedto be its own entry, needs to read thecssnano-hostentry instead.Output changes in this release:
- An existing
@charsetis dropped when its only non-ASCII text was in a rule that discardEmpty removes. The@charsetdecision now runs after that removal. - With the advanced preset, a container that held only at-rules discardUnused removes, such as
@media print{@keyframes a{…}}withaunused, is removed too, unless discardEmpty is disabled. An emptied named@layerstays, since it may fix the layer order. - With the advanced preset, an existing
@charsetis dropped when its only non-ASCII text was in an at-rule that discardUnused removes. - With the advanced preset, a container that held only a repeat definition mergeIdents removes is removed too, unless discardEmpty is disabled, such as an unnamed
@layerthat held@keyframes a{…}when another@keyframes a{…}survives. An emptied named@layerstays. - With the advanced preset, an existing
@charsetis dropped when its only non-ASCII text was a name that mergeIdents removes or reduceIdents renames.
- An existing
Minor Changes
-
feat(cssnano): merge the
outline-width,outline-styleandoutline-colorlonghands intooutline, and the three longhands of each logical border side intoborder-block-start,border-block-end,border-inline-startandborder-inline-end. A logical side is merged only for targets that parse it, and not beside a physical border property, an axis shorthand, a legacy-webkit-border-beforestyle spelling orall, which can set the same side in some writing modes.outlinekeeps its color, because the initialoutline-colordiffers between specifications, and mergesoutline-style: autoonly when every target parses it, because an engine without it would drop the whole shorthand. -
feat(cssnano): merge the longhands of
border-block,border-inline,grid-row,grid-column,grid-area,list-style,text-emphasisandtext-decorationinto their shorthands, where every target parses the shorthand and its components
Patch Changes
-
fix(cssnano): keep
anchor-size()inset sides unshortenedinset: anchor-size(width) 1px anchor-size(width) 1pxis no longer shortened toinset: anchor-size(width) 1px. The sides keep their written form, so the output is a few bytes longer with the same meaning. -
fix(cssnano): an at-rule name folds ASCII case only, so
@followed by a Kelvin sign is not@keyframesand is not discarded as overridden -
fix(cssnano): an at-rule whose name differs from a later one only by ASCII case is treated as the same at-rule
At-rule names are ASCII case-insensitive, but the merge pass kept
@Fooand@fooas two at-rules when it discarded duplicates. The earlier one is now removed, as it is for any other repeated at-rule. -
fix(cssnano): drop a
background-*longhand that repeats what thebackgroundshorthand before it already sets, such asbackground-image:noneafterbackground:red. Only a single-layer shorthand of keywords, a hex or named colour and aurl()counts, and only when every target parses it. -
fix(cssnano): a backslash that ends the last declaration of a block keeps the character it escapes. A value with a comment keeps its important comments and the space a removed comment stood for, and an escaped space before a semicolon or an
!importantflag is no longer replaced by the whitespace before the closing brace -
fix(cssnano): keep border side colours that fall back for
rgba()side coloursWhen each side’s colour, such as
border-top-color:#000, was followed by the same side inrgba(), cssnano merged the fourrgba()sides into oneborder-colorand then dropped the earlier colours, so a browser withoutrgba()lost the border colour. The earlier side colours now stay as the fallback. -
fix(cssnano): postcss-calc’s
mediaQueriesoption leaves a containerstyle()query unchangedA
calc()inside@container style()was reduced, although a style query matches the custom property as written. The other conditions of the container query are still reduced. -
fix(cssnano): postcss-calc’s
mediaQueriesoption reduces only@mediaand@containerpreludesWith
mediaQuerieson, postcss-calc reduced the prelude of every at-rule, so acalc()in an@supportscondition or an@importsupports()was rewritten. A reducedabs()can pass a feature test that the original fails, so those conditions are now left unchanged. -
fix(cssnano): keep colors that carry an escape hack such as
\9or\0/Colormin leaves a color unchanged when an escape hack, such as the IE
\9,\0or\0/, ends or directly follows it. This includes an identifier after a color function, such asrgb(255,0,0)\41. Before,red\9becamered, which every browser applies, andrgb(255,0,0)\9becamered \9. -
fix(cssnano): keep column longhands before an invalid two-term
columnsvalueA
columnsvalue with two math widths, such ascalc(1px) calc(2px), or two math counts, such ascalc(2) 3, is invalid, and browsers ignore it. cssnano treated it as valid and dropped thecolumn-widthandcolumn-countlonghands before it, so those longhands now stay. A two-term value with one math width and one math count, such ascalc(1px) 3, is valid and still merges. -
fix(cssnano): convert-values keeps a dot after a number, such as
1.,1.emor10.pxA number followed by a dot is invalid CSS, but convert-values read it as the valid number, so
opacity:1.becameopacity:1,width:1.embecamewidth:1emandcalc(10.px + 0px)becamecalc(10px + 0px). These values now stay as written, so a browser keeps ignoring them as it does in the source. -
fix(cssnano): convert-values keeps a unit that it would drop when the next token touches the number
0px.5px,0%top,100%%,50%%and50%e3were shortened to0.5px,0top,1%,.5%and.5e3. The unitless number joined the token after it, so valid CSS changed meaning and invalid CSS became valid. Such values now stay as written. -
fix(cssnano): convert-values keeps a
+number and readsU+ranges only inunicode-rangeOutside
unicode-range,margin: u+1.0e2was read asu+1followed by.0e2and becamemargin: u+10. Other values now use the default tokenizer, so the value keeps its number (u+100). A+sign is now dropped only after whitespace, a comment, punctuation or a bracket, so1px+1.0becomes1px+1instead of the merged token1px1, and-+1.0pxbecomes-+1pxinstead of the valid length-1px. WithtransformCustomProperties, a custom property that contains aU+range is left unchanged, since--x: u+1.0e2reads as a range inunicode-rangeand as a number elsewhere. -
feat(cssnano): discardDuplicates treats property names that differ only by ASCII case as the same property
A declaration such as
COLOR:redaftercolor:redis now removed as a duplicate. Custom properties stay case-sensitive, so--Fooand--fooare both kept. -
fix(cssnano): discardDuplicates no longer removes a block that differs from a later one only in the text of an important comment
A block with an important comment such as
/*! a */is compared by that text, so two such blocks are both kept. -
fix(cssnano): discardDuplicates removes many duplicates in linear time
Each removed duplicate made PostCSS scan its parent’s children, so a rule or stylesheet with many duplicates still took quadratic time. Removals are now collected and each block is rebuilt once. The output is unchanged.
-
fix(cssnano): selector lists that differ only in the whitespace around their commas are the same list
Duplicate discarding, and the comparison of nested rules’ containers, now treat
a, banda,bas one selector list, so a duplicate declaration under either spelling is removed, as it already was when both are spelled alike. The same holds for keyframe selectors, such as0%, 100%and0%,100%. A comment with whitespace beside it counts as whitespace there, as ina /* x */, b. Whitespace inside a selector still counts, since it can be a combinator, and so does a comment between two of its parts, as ina/**/.b. -
fix(cssnano): keep a statement at-rule and a block at-rule with the same prelude
discardDuplicates treated
@foo x;and@foo x{…}as equal, so the earlier one was removed when a later one followed it. Those are different constructs, so both are now kept. -
discardUnusedremoves a counter style that only an unused counter style extends in the same run, and keeps one that a used counter style names infallbackorspeak-as, or thatcounter(),counters(),target-counter()ortarget-counters()names incontent,bookmark-labelorcopy-into; it matches escaped names and predefined names in any case, and keeps every counter style when one of those declarations orlist-styleuses a substitution function such asvar(),env(), or anattr()with a fallback or a type that yields an identifier -
fix(cssnano): discardUnused matches font faces by the family name browsers use
A font face now stays when a rule names its family with different quoting, CSS escapes, spacing or ASCII case, and it goes when a used family only contains its name as a substring, such as
"Foo Bar"for a face namedFoo. A face with severalfont-familydescriptors stays when any of them is used, and a descriptor that is not a single string or a sequence of identifiers keeps the face. Avar()in a property other thanfont,font-family,animationoranimation-nameno longer keeps every font face and keyframes rule. -
discardUnusedkeeps a@keyframeswhose escaped or quoted name matches an animation’s name -
fix(cssnano): discard-unused keeps a namespace whose prefix is followed by a comment
A comment between a namespace prefix and
|reset the prefix, so@namespace ns url(x);ns/**/|a{}lost its@namespaceand the selector no longer had a declared namespace. Comments are removed before parsing, so the prefix is now kept and the output is@namespace ns url(x);ns/**/|a{}. -
fix(cssnano): keep keyframes and font faces that a substitution function may name
discardUnusedremoved a@keyframesor@font-facewhose name reached its use only throughvar(),env(),attr()or a custom function, such as:root{--a:foo}a{animation:var(--a) 1s}. A value holding one of these may name any keyframes or family, so they all stay now. A@font-facewithout afont-familyis still removed. -
fix(cssnano): property names are compared by their decoded spelling
\63olor:bluenamescolor, so.a{color:red}.b{\63olor:blue;color:red}is no longer merged into.a,.b{color:red}.b{\63olor:blue}, which changed the color of.b.\61 llisall, and--\61:1;--a:1keeps one copy, since--\61is--a. Custom properties stay case-sensitive. -
Keep a rule or at-rule prelude that ends in a backslash, followed by a slash, as written. The backslash escapes the slash, so the text after it is not a comment, and a space after the backslash would make the selector valid.
-
fix(cssnano): whitespace normalization keeps the space that an escape takes at the end of a selector, an at-rule prelude or a value
a\ {…},@media a\ {…},@keyframes fade\ {…},@layer a\ ;andfade\ !importantwere minified to text where the backslash escaped the{, the;or the!, which changed or broke the stylesheet. -
fix(cssnano): a folded
:is()now merges with an identical parsed:is()A selector whose
:is()came from an earlier fold did not share a prefix or suffix with a later selector that spelled the same:is()in its source, so the later fold was missed. The two now group together. -
fix(cssnano): a comment or the space before
;inside a value is no longer removed when its option is disabled and the longhand merge does not change the value.a{margin:1px/*c*/ 2px}keeps its comment withdiscardCommentsdisabled, anda{border-radius:.5em ;}keeps its space withnormalizeWhitespacedisabled, asa{color:red/*c*/}already did -
fix(cssnano): the stylesheet’s leading whitespace follows its first rule when a merge removes that rule
When the
advancedpreset’s rule merging emptied and removed the first rule of a stylesheet, the rule after it printed its own whitespace, and the leading whitespace was lost. The output now starts with the whitespace of the removed rule, as PostCSS prints it. -
fix(cssnano): the stylesheet’s leading whitespace follows its first child when that child is removed
When a removed rule, comment or charset led the stylesheet, its whitespace could be left out of the output, or the whitespace of a later removed rule could be printed. The output now starts with the whitespace of the child that remains first, as PostCSS prints it. The
advancedpreset no longer leaves leading whitespace when a merge moves the first rule. -
perf(cssnano): discardDuplicates is now linear, and merge-rules checks override order in linear time per round
discardDuplicates compared each node with every earlier node of the same kind, so large inputs with many @media blocks or declarations took quadratic time. It now compares equality keys in constant time. merge-rules no longer compares every pair of declarations when it checks whether sharing would change the cascade, so rules with many repeated longhands are faster. The output is unchanged.
-
fix(cssnano): merge longhands that use math functions when every target parses them
With explicit browser targets, a longhand set with a math function such as
clamp(),min(),max(),round(),mod()orrem()in a box property stayed unmerged, although every target parses the function. Targets such as Chrome 79, Firefox 75 and Safari 13.1 now merge the longhands formin(),max()andclamp(), as they already did forcalc().round(),mod()andrem()need Chrome 125, Firefox 118 and Safari 17.2, andabs()needs Chrome 138, Firefox 118 and Safari 15.4, so the longhands merge only for targets at or above those versions. -
fix(cssnano): hoist an escaped
directionorunicode-bidideclaration past a laterallalldoes not resetdirectionorunicode-bidi, but the merge pass compared the raw spelling of the property, soa{\64irection:rtl}b{\64irection:rtl;all:initial}kept the escaped declaration in both rules. The escaped name is now read asdirection, so the declaration is hoisted like the unescaped one. -
fix(cssnano): mergeIdents keeps definitions in different layers apart when the stylesheet has an
@importAn imported stylesheet can declare cascade layers before the importing one, as
@import url(x.css) layer(x)does, so the layer order is not known from the importing stylesheet alone. mergeIdents assumed the order of its@layerrules, so it could merge two@keyframesor@counter-stylenames that resolve to different definitions, or remove a repeat definition that won the cascade. In a stylesheet with an@import, it now merges names and removes repeat definitions only within one layer. -
fix(cssnano): merge-idents reads
@layer a\ {}as the layerathat@layer a\20 {}namesA block whose name ends in an escaped space, such as
@layer a\ {}, was read as the namea�, so it was a different layer from@layer a\20 {}. PostCSS keeps the escaped space inraws.betweenrather than in the layer’s params, and the layer reader now reads the prelude with that space, as merge-idents already does for keyframes and counter styles. -
fix(cssnano): ignore the names of a block
@layerwith a name listA block
@layertakes at most one name, so browsers drop@layer x, y{…}. mergeIdents still used it to orderxandy, so a later@layer y, x;could be overruled and the wrong repeat@keyframesor@counter-stylekept. Such a block now declares no layer. -
fix(cssnano): join rules whose declarations differ only in an
important: falseflagRule merging treated a declaration that longhand created with
important: falseas different from the same declaration without the flag, although both print without!important. A rule of four radius longhands now joins aborder-radiusrule with the same value, and rule merging keeps amargin: 0that a later rule with the same declaration had dropped. -
fix(cssnano): merge keeps a value’s important comment, such as
/*! k */, as writtenA longhand is not folded, rewritten or removed when its value holds an important comment, and no shorthand is merged across it. Before,
margin:0 /*! k */ 1pxbecamemargin:0 1pxandmargin-top:1px /*! k */;margin-top:2pxbecamemargin-top:2px, losing the comment. A plain comment in a value still goes when the value is rewritten. -
fix(cssnano): the merge pass keeps an important comment beside whitespace in a selector
PostCSS keeps a selector comment that has whitespace beside it only in the raw selector, so a merge that rebuilt the selector from
rule.selectorslost it:c{color:red;margin:0}a /*!x*/,b{color:red;margin:0;top:0}becamea,b,c{color:red;margin:0}a,b{top:0}. The walk now moves such comments into the selector, and the output isa /*!x*/,b,c{color:red;margin:0}a /*!x*/,b{top:0}. -
fix(cssnano): merge keeps a declaration whose value has an important comment, such as
/*! k */, apart from the same value without itRule merging and duplicate discarding compare a declaration by its value as written when that holds an important comment, so
color:red/*! k */;is no longer treated ascolor:red. Before,a{color:red/*! k */;}b{color:red}becamea,b{color:red}, losing the comment. -
feat(cssnano): merge-rules joins a rule into an earlier one when the join breaks even
A later rule that repeats a declaration of an earlier rule now gives it up and adds its selector to the earlier rule even when this saves no bytes by itself. The repeated declaration then no longer stands between the earlier rule and further rules, which can join it and shorten the output.
-
fix(cssnano): rules whose selectors differ by an escaped space are not merged
A selector ending in an escaped space, such as
a\, selects an element whose name ends in a space, which is not the elementa. Rules witha\ ,banda\,bas selectors were joined as if they were one selector, soa\ ,b{color:red}c{top:0}a\,b{color:blue}gavea\ ,b{color:red;color:blue}c{top:0}, which made the elementablue. Now the first input is left unchanged, and the second gives@media print{a\ ,b{color:red}a\,b{color:blue}}c{top:0}, keeping both rules apart. -
fix(cssnano): mergeRules keeps a hacked declaration apart from the same property without the hack
A declaration such as
_height:1pxor*zoom:1is no longer merged withheightorzoomon another rule. Modern browsers ignore the hack, so the merge would apply the property to the rules it was moved to. -
fix(cssnano): mergeRules no longer mistakes text that only looks like
:hostor a mixin for oneRules whose selectors use the
:hostor:host-context()pseudo-class, or end in a colon as a mixin does, are still kept apart. But a:hostthat only appears inside an attribute value, such as[title=":host"], no longer stops a merge, and neither does an escaped colon in a class or element name, such as.a\:hostora\:. -
fix(cssnano): mergeRules joins many rules with the same selector in linear time
Each rule joined into an earlier rule with the same selector made the earlier rule rebuild its property table and rescan its children, and made PostCSS scan the stylesheet to remove the joined rule. A stylesheet alternating two selectors took quadratic time: 10,000 rules took 15.9 s and now take 0.15 s. The output is unchanged.
-
fix(cssnano): list a selector both rules share once in a partial merge
.a,.b{color:red;top:0}.a,.c{color:red;left:0}now becomes.a,.b{top:0}.a,.b,.c{color:red}.a,.c{left:0}, where the previous output kept both rules. -
fix(cssnano): merge removes a declaration that repeats a later one after a stray semicolon
A stray
;before a declaration is no longer read as a browser hack, soa{zoom:1;;zoom:1}keeps onezoom:1. -
fix(cssnano): escape a font family name that is a lone hyphen
font-family: "-"becamefont-family: -. A bare hyphen tokenizes as a delim, so the family list was invalid and browsers ignored the declaration. It is now\-. The preset snapshot is unchanged. -
fix(cssnano): minify a selector list whose duplicate items leave one selector
A selector list such as
.a,\n.aor.a.b, .a.bnow minifies to its one remaining selector,.aor.a.b. It stayed unchanged before. -
fix(cssnano): keep the whitespace around
\9inside a stringThe IE hack’s
\9was matched in the whole value, socontent:"a \9 b"becamecontent:"a\9b", which changes the string. Only the text outside strings is now trimmed around\9. -
fix(cssnano): normalize-whitespace keeps the whitespace after
\9that separates two componentsThe space after a
\9escape ends the escape. Dropping it turned1px\9 ainto1px\9a, which reads as the character U+009A, and dropping the whitespace after it joined two components, so1px\9 solidbecame1px\9solid. Both are now kept. The whitespace is still removed before a delimiter such as,or!, and at the end of the value. The preset snapshot is unchanged. -
fix(cssnano):
offset-block-*andoffset-inline-*are compared with theinset-*properties they alias.a{inset-block-start:0}.b{offset-block-start:1px}.a{inset-block-start:2px}is no longer merged into.a{inset-block-start:0;inset-block-start:2px}.b{offset-block-start:1px}, which changed the value ofinset-block-starton an element matching both rules in browsers that spell the flow-relative insets withoffset-.Merges across
offset-block-*andoffset-inline-*and the Motion Pathoffset,offset-path,offset-distance,offset-position,offset-anchorandoffset-rotateproperties, or theplace-content,place-itemsandplace-selfproperties, are no longer blocked, since none of those sets an inset. -
fix(cssnano):
cjk-ideographicis a predefined counter style, so reduce-idents no longer renames a style with that name and discard-unused keeps the override; a counter style name folds ASCII case only, so a name spelled with a Kelvin sign is notkhmer -
fix(cssnano): reduce-transforms keeps the text after a reduced function whose argument also reduces
transform: scale(scale(2,1), 1) translate(0)becamescaleX(scale(2,1))translate(0): the inner reduction shortened the text before the outer one was applied with its original offsets, so the space after the outer function was lost. Only the outer reduction now applies, and the value becomesscaleX(scale(2,1)) translate(0). -
Keep a selector list that ends in an invalid escape invalid when the comment before a comma is removed, instead of turning its trailing backslash into a valid escape.
-
fix(cssnano): a selector list whose item ends in a backslash stays as written when a neighbouring rule merges into it
A rule such as
.a\followed by a newline and,.bis invalid. When a later rule with the same declarations merged into it, cssnano rewrote it as the valid selector.a\,.b. It now keeps the list as written. -
fix(cssnano): an item that ends in a backslash before a newline stays invalid
A selector or at-rule prelude ending in
\before a newline is invalid. cssnano rewrote its newline as a space, which escapes the space and makes it valid, and it let a later list with the same item inherit that valid reading. The newline and the invalid reading are now kept. cssnano also no longer deduplicates or reorders a selector list that has such an item, no longer merges@layer a\followed by a newline with@layer a\followed by a space, and keeps the newline when it removes a comment after the backslash, in a selector or an at-rule prelude. -
fix(cssnano): update reference data
-
fix(cssnano): drop a longhand’s fallback once a later shorthand overrides it
When merge-longhand folds declarations into a shorthand, it keeps an earlier value only while it is still a fallback for the declaration that now sets that side. Before,
a{margin-left:1px;margin-left:var(--a);margin:2px 1px}keptmargin-left:1pxafter removing thevar()declaration it backed up. A second run then removed it, so the output was larger than needed and running cssnano twice gave a different result. The same applies toborder-radiusandcolumns. -
fix(cssnano): postcss-unique-selectors keeps the empty selector of a list with comments, so the rule stays invalid
A selector list with a comment in an item and an empty item, such as
:is(/*a*/.x,/*b*/.y), :is(.x,.y),, lost its empty item, which made the rule valid and applied it in browsers that ignore the rule. The empty item is kept. Deduplicated selectors are joined with a bare comma, without the space that followed the comma before. -
fix(cssnano): no declaration moves past a write of another property when the property data does not describe one of the two, so a vendor-prefixed property no longer lets a later or earlier declaration of a known property overtake it
-
fix(cssnano): an
@CHARSETthat is not written in lowercase is left as it isBrowsers read an encoding only from the exact lowercase
@charsetbytes, so any other case is an unknown at-rule. The charset normalization no longer removes it, moves it or rewrites it to lowercase, which would have turned an ignored rule into a live encoding declaration. -
Keep the newline after a final backslash in a declaration value when a comment after it is removed, so the backslash no longer escapes the closing brace or semicolon.
-
fix: update browser compatibility information
-
fix(cssnano): zindex leaves a z-index value with more than one component as written
z-index: 100 200andz-index: 1/*c*/00are invalid and browsers ignore them, but zindex rewrote them to a valid number, which changed how the page renders.
9.9.0
Minor Changes
-
cssnano now ships its presets and plugins in a single package, so installing it adds one cssnano package to your dependency tree instead of about thirty, and you have fewer packages to review in audits and lockfile updates.
preset: 'lite'andpreset: 'advanced'now work without installing another package. An installed preset package still takes precedence over the built-in one and prints a one-timeCSSNANO_INSTALLED_PRESETwarning; pass the imported preset function to keep it without the warning. Full names such ascssnano-preset-defaultfall back to the built-in preset when no package is installed. Projects that requirecssnano-preset-defaultdirectly must declare it as a dependency, or switch topreset: ['default', {...}].overridesandresolutionsthat pin an individual plugin no longer apply.
9.8.0
Minor Changes
-
feat(postcss-normalize-url): stop rewriting URLs
The plugin only changes the
url()token (unquoting, whitespace, escaping) and keeps the URL byte-identical. It no longer removes dot segments or duplicate slashes, decodes percent-escapes, removes default ports or strips the trailing dot of host names, because these are not equivalent for every server or bundler. It keeps whitespace inside a quoted@namespaceURL as well, because the namespace name is an identifier compared character by character rather than a URL that gets fetched. -
feat(cssnano-preset-default): remove postcss-svgo from the preset
The presets no longer run
postcss-svgo; run it before cssnano or optimize SVG assets with the SVGO cli instead. Asvgooption is now ignored. The output changes for CSS with inline SVG data URIs, and for CSS with URLs thatpostcss-normalize-urlused to rewrite (see thepostcss-normalize-urlchangeset).
Patch Changes
- Always convert between
cmandmm, and convertqtocmormm, since metric units relate by exact decimal factors.qis never the output unit.
9.7.0
Minor Changes
- feat(postcss-minify-params): drop a
min-*ormax-*already implied in another range in the same media query
Patch Changes
- fix(postcss-merge-rules): merge at-rules separated by unrelated rules
9.6.0
Minor Changes
- feat(postcss-merge-longhand): merge
row-gap/column-gap,overscroll-behavior-x/-y,flex-direction/flex-wrap,column-rule-*and equaloverflow-x/-yinto their shorthands when every target supports them
Patch Changes
-
refactor: remove cssesc dependency
-
fix: improve escape handling in selectors
-
fix: update postcss-calc
-
fix(postcss-minify-selectors): match escaped pseudo-class and pseudo-element names ASCII-case-insensitively, so U+212A KELVIN SIGN no longer folds to
k. This covers escaped pseudo names,:nth-*keywords such asof,oddandeven,fromin keyframe selectors, andurl()in namespace rules -
fix: accept the optional leading rounding strategy of
round(), such asround(up, 1s, 1s), when postcss-ordered-values orders animations and transitions and when postcss-merge-longhand folds shorthands. The rounding strategy must be separated by a comma, soround(up 1px, 2px)is no longer treated as valid. postcss-merge-longhand no longer folds math functions with missing operators, such ascalc(1px 2px). postcss-merge-longhand, postcss-ordered-values and postcss-merge-rules now compare property names, keywords and units ASCII-case-insensitively.
9.5.0
Minor Changes
- feat(postcss-normalize-unicode): merge adjacent, overlapping, and out-of-order unicode-range entries, and emit a wildcard range when they cover a range expressible with trailing
?wildcards
Patch Changes
- fix(postcss-normalize-whitespace): trim and collapse spaces and tabs between the names of each string row in
grid-template-areas,grid-templateandgrid.
9.4.0
Minor Changes
-
feat(cssnano-preset-default): run postcss-merge-longhand again after postcss-merge-rules, so declarations overridden in a later rule with the same selector are discarded
-
feat(postcss-merge-longhand): merge flow-relative and physical box properties safely
The plugin now merges and shortens
margin-block,margin-inline, theirpadding,inset,scroll-marginandscroll-paddingcounterparts, and the physicalinset,scroll-marginandscroll-paddinglonghands. It never assumes a writing mode or direction, so a flow-relative declaration moves only where no physical declaration of the same group. It creates a shorthand only when every browserslist target supports it. -
feat(postcss-merge-longhand): discard overridden same-property declarations
Within a rule, a declaration is dropped when a later declaration of the same property and the same
!importantoverrides it, and every browser that accepts the earlier value accepts the later one.
Patch Changes
-
fix: update postcss to 8.5.29
-
fix(postcss-merge-longhand): keep fallbacks for older browsers in more cases. Longhands that use
calc()merge into a shorthand only when every target parsescalc(), which Opera Mini, and so the default targets, do not. When a browserslist target predates the support floor (such as IE 8 or Opera 12), the plugin keeps fallbacks forrem, angle and time units andhsl(), sofont-size:16pxbeforefont-size:1remsurvives. -
fix: update color processing library
-
fix(postcss-merge-longhand): add missing tokenizer runtime dependency
9.3.2
Patch Changes
-
Leave
animationuntouched when the keyframes name is a keyword another longhand would claim, such asanimation: ease 1s linear. Reordering the name first made browsers read it as the timing function, direction, fill mode or play state. -
Omit trailing zero blur radius and spread distance in
box-shadow, e.g.0 50px 0 0 #fffbecomes0 50px #fff. -
Merge
column-widthandcolumn-countintocolumnswhen the width is zero, for examplecolumn-width:0px;column-count:2becomescolumns:0px 2. CSS Sizing 4 allows a zerocolumn-width; a zerocolumn-countstays invalid and is left untouched. -
Share declarations among several adjacent rules also if the file size can be reduced by merging more than two rules. Previously rules were only merged when the first merge immediately yielded a saving, without checking if further merging was possible.
9.3.1
Patch Changes
- feat(cssnano-utils): add sameContainer export
9.3.0
Minor Changes
- Merge rules with the same selector and sibling
@media,@supportsand@containerblocks with identical conditions even when other rules sit between them, when none of those rules sets a conflicting property.Do not merge rules acrossall, shorthands that reset their longhands, logical properties that can address the same side, and at-rules whose order matters, such as@layerand@import. Adjacent rules with the same selector now become one rule. Add the selectors of a later rule to an earlier rule with the identical declaration.
Patch Changes
-
Keep an empty
@layerblock when it may fix the layer order. Decode CSS escapes before comparing@layernames. -
Remove the enclosing named
@layerand conditional blocks that moving a rule out of a nested conditional group rule left empty. -
Do not merge nested rules when a conflicting declaration from the enclosing rule lies between them, so
.p{&{color:red}color:blue;&{color:red}}stays red instead of blue. -
Determine the vendor prefix of a selector only from its pseudo-class and pseudo-element names. A class name or attribute value such as
.x-moz-yor[title=":-moz-x"]no longer blocks merging with a::-moz-selectionrule, and a selector that mixes two vendor prefixes is never merged. Compare pseudo-element names case-insensitively, so::-WEBKIT-scrollbarnow counts as WebKit-prefixed and stays apart from unprefixed rules.
9.2.2
Patch Changes
-
Fix an infinite loop: when equal
@mediablocks were separated by an at-rule such as@layer x;,@font-faceor@page, the plugin would keep merging a rule into itself until memory ran out.Fix a bug when the plugin moved a rule into a block nested inside another block: a later merge could combine two rules in reverse order and change which declaration wins.
9.2.1
Patch Changes
-
Remove a declaration that a later sibling
@media,@supports,@containeror named@layerblock with identical conditions repeats, so duplicates are dropped beforepostcss-merge-rulesjoins the blocks.Keep an earlier duplicate
@media,@supportsor@containerblock that declares an@layer, so removing it no longer moves the layer’s first appearance and changes the layer order. Also keep a rule that holds a/*!comment when its declarations are removed.Keep a duplicate
@import, so removing the earlier copy no longer changes the layer order. -
Keep
"revert-rule"quoted infont-familybecauserevert-ruleis a CSS-wide keyword. -
Recognise
revert-ruleas a CSS-wide keyword.postcss-ordered-valuesno longer reorders aborder,animation,transition,list-style,box-shadoworgrid-rowvalue as ifrevert-rulewere a color, name or type. The reserved keywords are now generated from@webref/css.
9.2.0
Minor Changes
- Merge box alignment properties into the
place-content,place-itemsandplace-selfshorthands, such asalign-items:center;justify-items:startintoplace-items:center start. This only happens when every browser in your Browserslist targets supports the shorthands, because a browser that does not would ignore both alignments. Thedefaultsquery includes browsers with unknown support, such as Opera Mini and UC Browser, so it keeps the longhands. Values that usesafe,unsafeorlast baselinemerge only when both values use the same keywords.postcss-merge-longhandnow accepts the Browserslist optionsoverrideBrowserslist,stats,pathandenv.
Patch Changes
-
Write numbers in scientific notation when it is shorter, such as
1e-6pxfor0.000001pxand1e6pxfor1000000px. This also applies whenlengthunit conversion is disabled. Numbers written without a decimal point, such asz-index:1000000, keep their form, because an<integer>cannot use scientific notation. -
Stop merging longhands across a nested rule or at-rule. The shorthand ended up after the nested rule and overrode it, so in
a{margin-top:1px;&{margin-top:2px}…}the nestedmargin-topwas lost. This applies tomargin,padding,border,border-radiusandcolumns. Declarations on each side of a nested rule are now merged separately. An at-rule without a block, such as@apply x;, also separates them, since it may add declarations. An empty rule such as&{}does not. Aborder-imageoralldeclaration before a nested rule no longer prevents merging theborderlonghands after it. -
Stop merging rules that have an invalid selector, such as
b: hover,[a b],:lang(en fr)ora||b. An invalid selector makes the whole selector list invalid, so the browser also dropped the valid rule it was merged with. -
Only treat a dimension as the font size in the
fontshorthand when it has a length unit. An invalid value such asfont:bold 1s "Arial Black"is now left unchanged. -
Leave the
fontshorthand unchanged when it containsattr(),if(),inherit()or a custom function such as--name(), as already done forvar()andenv(). Their result is only known when the browser computes the value. -
Remove a zero color stop position only when it has the right type for the gradient.
conic-gradient()now drops0degand keeps an invalid0px, while linear and radial gradients still drop0px.-webkit-linear-gradient()keepsto bottomand othertodirections as written, since the prefixed syntax measures angles differently. -
Stop turning a comment inside a selector into a descendant combinator. A comment is not whitespace, so
.a/**/.bselects elements with both classes, including inside:is(), and is no longer rewritten as.a .b. Invalid selectors such asdiv/**/spanare left as written instead of becoming valid. -
Leave rules with an invalid selector unchanged, including an ID selector that starts with a digit, such as
#1a, and a combinator after a pseudo-element, such asa::before b. -
Shorten
top centerandbottom centertotopandbottom, instead of0and100%, which the browser reads as horizontal positions.center topandcenter bottomare now shortened the same way.Leave a position unchanged when it cannot be safely rewritten:
- in a
backgroundlayer where another value splits the position, as inleft no-repeat center, which is invalid; - when it contains a function such as
attr(),if()or a custom--function(), which may return a keyword, asvar()already did; - when an invalid three-value position contains a math function, such as
left abs(1px) top, ascalc()already did.
- in a
-
Keep strings unchanged when removing a line continuation (a backslash before a newline) right after an escape. In
"\31followed by a line continuation and2", joining the lines would turn\31into\312, so the result is now"\31 2".Leave
@charsetunchanged. Browsers only recognize it with double quotes, so rewriting single quotes would make an ignored@charsettake effect. -
Update
postcss-calcto 11.2.2. Multiplications insidecalc()now keep their original operand order, socalc(var(--x) * 5)is no longer rewritten ascalc(5 * var(--x)).
9.1.2
Patch Changes
-
Omit redundant whitespace after @media and @supports when parameters begin with parentheses, and normalize multi-character whitespace after at-rule keywords.
-
fix: update browserslist
9.1.1
Patch Changes
- Preserves Unicode range tokens (
unicode-range) in font descriptors and custom properties, preventing code point ranges from being corrupted into invalid numbers or dimensions.
9.1.0
Minor Changes
- Merge corner
border-*-radiuslonghands intoborder-radiusshorthands. Four complete corner declarations in the same importance lane now collapse into one shorthand, with horizontal and vertical axes minified independently and separated by a slash when distinct. Declarations in the radius family are decoupled from physical border fast-path eligibility, allowing rules containing both physical borders and border radii to optimize both families.
Patch Changes
-
Merge margin, padding, border, border-radius, columns, and border-spacing declarations inside at-rule containers such as
@page,@position-try, and nested at-rules. Fold identical horizontal and verticalborder-spacingcomponents to a single value. Recognizecolumnsshorthands combining a count and a math function in either order, and preserve invalid declarations as written: border shorthands with multiple styles andcolumnsvalues combining CSS-wide keywords with widths or counts no longer discard preceding valid longhands. -
Preserves percentage units in registered custom-property initial values with composite syntax, ranges, groups, and multipliers, and avoids clamping numeric operands nested inside alpha-value functions.
-
Restricts color minification to CSS properties that accept
<color>and custom properties, preserving custom identifiers in properties likeanimation-name,grid-area, andcounter-reset. Adds support forhwb()color values and minification insidecolor-mix(),light-dark(), andvar()fallbacks, while preserving relative color syntax, math functions, and token boundary separators. -
Preserves zero percentage units in rgb(), rgba(), and modern CSS Color 4 functions to avoid invalid syntax, respects disabled time conversions for 0ms, clamps percentage opacity values adhering to CSS Color 4 alpha semantics, and improves compatibility with uppercase at-rules and vendor-prefixed keyframes.
-
Preserves zero length in
columnsshorthands and zero units inside@propertywith<angle-percentage>syntax, retaining keyframe percentage units under nested rules. Symmetrically rounds negative numbers when precision is configured, converts between metric units (mm,cm,q), preserves zero percentages on SVG stroke properties to retain transition interpolation, and caches Browserslist lookups across runs. Also preserves units inside CSS Fonts 5 override descriptors,anchor()functions,flex-basis, and IE-targeted sizing properties. -
Remove comments more reliably and preserve the ones you keep exactly. Comments are now removed from declaration values that carry
!important, and comment detection respects CSS token boundaries: text inside unquotedurl()values and behind escape sequences in strings and identifiers is no longer mistaken for a comment. Kept comments are emitted byte-for-byte, including an unclosed comment at the end of a value, and whitespace inside kept comments is left untouched. Removal state is scoped to each document, so a shared processor no longer carriesremoveAllButFirstfirst-comment state between runs, and theremovecallback runs once per comment occurrence. A non-functionremoveoption now fails with aTypeError. -
Adds the balanced token index used by selector, parameter, and gradient minification while preserving their serialized CSS output.
-
Improve conformance for modern CSS math functions, grid-line values, and case-sensitive attribute selector modifiers while preserving ambiguous or invalid declarations. The affected transforms now use bounded, linear scans for these forms.
-
Value transforms now read the CSS Values 4 math function names from one
mathFunctionstable incssnano-utils, so unit retention, box and shorthand merging, parameter and whitespace handling, and time classification agree on which functions count as math functions. Serialized output is unchanged. -
Standardize output normalization for margin, padding, and physical border properties. Property names and case-insensitive keywords in generated shorthands and normalized standalone shorthand declarations are canonicalized to lowercase, while preserving author casing for unmerged longhands, custom properties, hack prefixes, and unresolved values.
-
perf: median 15% speed increase on test fixtures
-
postcss-normalize-urlnow decodes quotedurl(...)values, preserving literal backslashes and escape sequences whether quotes are stripped or kept. Relative URLs now normalize using POSIX path semantics across all platforms, and converted@namespaceURLs escape double quotes. -
Join every escaped line continuation in a multiline
url()value into one line, including\r\ncontinuations that previously survived and left an invalid string behind. Rewriting a@namespaceURL no longer overwrites the tokens that follow it, so trailing text is preserved and multiple URLs in one namespace declaration are each normalized. -
Remove insignificant whitespace around custom-property names and, in standard declarations, around
env()custom-ident arguments and around comma delimiters invar(),env(), andconstant(). Between a custom-property name and its value, only the parser-consumed leading whitespace run is dropped; authored whitespace elsewhere in the value, such as after a preserved comment, is preserved per CSS Variables 1. Required whitespace between distinct tokens and the single whitespace token in an empty fallback remain preserved, and a preserved comment kept between a declaration name and value now survives minification, for custom properties and standard declarations alike. Comment removal in selectors and values no longer fuses the tokens the comment sat between: an attribute case-insensitivity flag or any other name-like token keeps its boundary, and math-operator spacing is restored for every function whose value productions accept<calc-sum>arguments (includingcalc-size(),calc-mix(), andrandom()). Values without comments are now left byte-for-byte untouched rather than re-spaced. -
Preserve whitespace around division operators across all modern CSS math functions such as
min(),max(), andclamp(), and ensure commas in nested calculations have extraneous whitespace trimmed. -
Orders
columns: 2 autoascolumns: auto 2. Leaves animation declarations with negative iteration counts unchanged. Reorders border and box-shadow math functions that resolve to a length, such ascalc(1px + 1em), and leaves other math unchanged. Passes through unknown box-shadow color functions instead of reordering them. -
Merge duplicate
@keyframesand@counter-styledefinitions more conservatively. -
Use ASCII case-insensitive matching for CSS names and grammar keywords so Unicode lookalikes are preserved, and restrict CSS whitespace normalization to the CSS whitespace set.
-
Rename identifiers only when their definition and a reference share a stylesheet; leave alone names inside
var(),env(),attr(), or a custom property fallback; skip reserved words in the encoder; renamereversed()counters and implicit<area>-start/-endlines with their area. -
Preserve Windows drive roots, directory dot references, and leading
./prefixes when the first relative segment contains a colon. Decode unreserved percent-encoded octets while preserving percent-encoded dots, normalize@importat-rules including nested condition URLs, retain quotes for URLs containing non-printable control characters, avoid unnecessary declaration tokenization, and synchronize raw parameters. -
Minify equal shorthand components for two-axis, four-side, alignment, aspect-ratio, and transition declarations while preserving grammar-sensitive and invalid values.
-
fix(postcss-minify-params): support CSS values level 4 and Media Queries level 5
-
Preserves invalid selector syntax and namespace-sensitive universal selectors while safely normalizing pseudo-element, View Transition, and keyframe forms. Recognizes the full token grammar for An+B formulas, including escaped forms and exact large integers.
-
fix(postcss-ordered-values): improve performance and correctness
-
Aligns SVG data URI processing with WHATWG URL standards by treating the first
#as the fragment delimiter. Non-conforming data URLs (such as those with malformed percent-encoding or where an unencoded#in markup truncates the SVG payload) are left untouched rather than parsed with an internal XML recovery scanner. CSS hex escapes in the URI scheme (for exampled\61ta:image/svg+xml) reach the optimizer. SVG data URIs inside CSS Values 4src(...)functions orurl(...)declarations with url-modifiers are optimized while preserving modifiers and comments. Minified declarations also keep their raw value metadata in sync. -
Unify physical-border optimization under a single reducer that chooses deterministic shortest non-crossing canonical shorthands from complete side and component groups, partitioned by importance lane. Partial grids no longer require a full border reset. Dynamic declarations, style hacks, CSS-wide keywords, support fallbacks, unresolved substitutions, and other cascade barriers remain in their original positions, while valid fallback and border-image behavior is preserved.
-
Parse font weights and column units from tokenizer metadata. This safely minifies escaped
boldweights, recognizes escaped length units, and prevents partial rewrites of invalid font shorthands while preserving original source spelling. -
update browserslist
-
Preserve matching-importance all reset boundaries when merging margin, padding, physical border-radius, and columns declarations, so minification does not restore values cleared by the reset.
9.0.5
Patch Changes
-
fix: updae browserslist, mdn-data, autoprefixer
-
fix(postcss-svgo): better decode encoded SVG
-
fix: update postcss-calc
-
fix: update calc and color minifiers, autoprefixer
9.0.4
Patch Changes
- fix(cssnano-preset-default): update postcss-calc
9.0.3
Patch Changes
-
fix(postcss-colormin, postcss-minify-gradients): update color parsing library
-
fix: update postcss and selector parser
-
fix: update conflict detection and color conversion CSS spec conformance
-
fix: update PostCSS peer dependency
9.0.2
Patch Changes
- fix: ensure older tools can resolve cssnano packages
9.0.1
Patch Changes
-
perf(postcss-minify-selectors): avoid quadratic selector scanning
-
pef(stylehacks): avoid rescanning the nodes when checking for compatibility hacks
9.0.0
Major Changes
-
breaking: do not load configuration from package.json
-
cssnano now discovers configuration only in the current working directory, using
.cssnanorc.jsonorcssnano.config.jsin that order. -
The cssnano packages are now native ESM and require Node
^22.22.3 || ^24.15.0 || >=26.0. Package subpath imports are no longer supported. See the migration documentation before upgrading. -
fix!(cssnano): introduce new postcss-calc plugin
Patch Changes
- Updated dependencies:
- cssnano-preset-default@9.0.0
8.0.10
Patch Changes
- fix(postcss-normalize-charset): ensure idempotent charset normalization
8.0.9
Patch Changes
- fix: update svg and color processors
8.0.8
Patch Changes
- fix(postcss-minify-gradients): follow CSS specification more closely when minifying gradients
8.0.7
Patch Changes
-
fix(postcss-ordered-values): recognise easing functions
-
fix(postcss-reduce-initial): update MDN data
-
fix(cssnano): tighten option types
-
perf(postcss-merge-rules): cache negative browser-support results when deciding whether to merge rules
Checking whether a selector feature is supported by the target browsers previously skipped the cache whenever the feature was not supported, so every occurrence of an unsupported feature re-ran the browserslist/caniuse lookup. This is now cached, which speeds up rule merging.
-
fix(postcss-discard-empty): remove empty cascade layers when they do not affect the layer ordering
-
fix(postcss-normalize-whitespace): stop dropping the escaped character in a trailing backslash escape
Keep the whitespace character when a declaration ends in a backslash character followed by a whitespace character and the declaration is the last in its rule, instead of leaving a dangling character and invalid CSS
8.0.6
Patch Changes
-
fix(postcss-minify-selectors): preserve namespaced universal selector
-
fix(postcss-merge-rules): keep the cascade intact when hoisting declarations
-
fix(postcss-merge-rules): decide property conflicts from spec data
The plugin decides whether to reorder declarations using
@webref/cssdata instead of a name-based heuristic. For example, the plugin now recognizes thatfontandline-height,border-widthandborder-left,gapandrow-gap, andinsetandtopconflict, and that a flow-relative property and its physical counterpart override each other.The plugin now merges properties that do not override each other, but only share part of the name, such as flex
andflex-direction`. Vendor extensions that are not part of a W3C specification still fall back to comparing names. -
fix(postcss-merge-longhand): improve shorthand merging correctness
Reject merges producing invalid values for
border,margin, orpadding; do not confuse math functions with border styles or colors; preserve fallback declarations before functions likeenv()orcalc(); correctly weight!important; and stop resurrecting declarations overridden elsewhere. -
fix: ensure packages reach registry with correct repository field
-
fix(postcss-merge-rules): merge interleaved declarations correctly
-
fix(postcss-reduce-idents): rewrite identifiers based on spec data
Which declarations define and reference a custom identifier now comes from
@webref/cssinstead of matching property names against a substring. The plugin no longer leaves a renamed identifier dangling behind:- a
@counter-stylerenamed while another rule’sfallbackdescriptor, or acounter()/counters()/target-counter()argument, still names it by its old name - a gridline or grid area named by the
gridshorthand, which was never rewritten even though thegrid-areaplacing against it was - a gridline named inside
repeat()orminmax() - a counter the experimental
string-setproperty
It also no longer renames a keyframe name appearing where it is not allowed, such as
animation-timing-function, and only renames the argument of a counter function that names a counter, rather than every word inside it.Identifiers identical to a keyword of the property or descriptor, such as an animation called
linear, a counter style calledinside, or thewordsofspeak-as: words, are now left alone: which of the two a value means depends on the order the grammar is matched in, so renaming it was unsafe.The counters the user agent maintains itself,
list-itemandpage, are no longer renamed either. - a
8.0.5
Patch Changes
-
fix(postcss-merge-longhand): avoid merging border declarations when result is not equivalent
-
fix: update dependencies
8.0.4
Patch Changes
-
fix(postcss-svgo): encode chracters in the correct order
-
fix(postcss-svgo): do not roll our own URI encoding
Our own code, while producing smaller output, might end up producing the wrong encoding, since it does not encode all characters.
8.0.3
Patch Changes
-
fix(postcss-normalize-url): add missing TypeScript files
-
chore: regenerate all type definitions with TypeScript 7
-
fix: update svgo, autoprefixer and postcss
-
fix: update PostCSS
-
chore: define package.json exports
-
chore: update dependencies
Update autoprefixer, browserslist, colordx and postcss
8.0.2
Patch Changes
- chore: update the postcss peer dependency
- Updated dependencies
- cssnano-preset-default@8.0.2
8.0.1
Patch Changes
- fix(postcss-minify-selectors): avoid folding some selectors incorrectly
- Updated dependencies
- cssnano-preset-default@8.0.1
8.0.0
Major Changes
-
ea8e33a: chore: drop Node.js 20 support
Node.js 20 has reached end of life.
-
d7c57da: Removed
cssDeclarationSorterfrom thedefaultpreset. It remains enabled in theadvancedpreset.Motivation
The plugin can cause breakages without notice whenever a new CSS longhand property is released to browsers if it happens to cause a conflict with another longhand property. To ensure safety and predictability, it is no longer enabled by default.
How to Update
If you rely on declaration sorting, you can switch to the
advancedpreset or explicitly enablecssDeclarationSorterin your configuration.
Patch Changes
- aa11a12: chore: update PostCSS
- Updated dependencies [aa11a12]
- Updated dependencies [ea8e33a]
- Updated dependencies [d7c57da]
- cssnano-preset-default@8.0.0
7.1.9
Patch Changes
- fix(postcss-minify-selectors): do not fold non-standard selectors
- Updated dependencies
- cssnano-preset-default@7.0.17
7.1.8
Patch Changes
- 0005443: fix(postcss-minify-selectors): fix wrong behaviour when merging into is()
- 7e56dba: fix: update postcss
- Updated dependencies [0005443]
- Updated dependencies [7e56dba]
- cssnano-preset-default@7.0.16
7.1.7
Patch Changes
- fix: publish all dependencies with attestations
- Updated dependencies
- cssnano-preset-default@7.0.15
7.1.6
Patch Changes
- 322ad33: fix: update postcss peer dependency
- Updated dependencies [322ad33]
- cssnano-preset-default@7.0.14
7.1.5
Patch Changes
- fix: update dependencies
- Updated dependencies [5cb8b09]
- cssnano-preset-default@7.0.13
7.1.4
Patch Changes
- fix: improve color conversion precision
- Updated dependencies
- cssnano-preset-default@7.0.12
7.1.3
Patch Changes
- c3e537a: fix: update postcss-selector-parser
- 5b9af42: fix: update browserslist and autoprefixer
- Updated dependencies [c3e537a]
- Updated dependencies [5b9af42]
- cssnano-preset-default@7.0.11
7.1.2
Patch Changes
- Updated dependencies
- cssnano-preset-default@7.0.10
7.1.1
Patch Changes
- fix: do not strip % sign inside linear()
- Updated dependencies
- cssnano-preset-default@7.0.9
7.1.0
Minor Changes
- Update to SVGO 4.0
- Update browserslist
7.0.7
Patch Changes
- 2f03871: fix: update lilconfig and browserslist
- perf: load default preset on startup
- 5672148: fix: update PostCSS peer dependency to version without vulnerabilities
- Updated dependencies [2f03871]
- Updated dependencies [171b669]
- Updated dependencies [20f4eb6]
- Updated dependencies [5672148]
- cssnano-preset-default@7.0.7
7.0.6
Patch Changes
- Updated dependencies [024ddef]
- Updated dependencies [1d65a10]
- cssnano-preset-default@7.0.6
7.0.5
Patch Changes
- f14a898: chore: update all dependencies
- Updated dependencies [dff5c42]
- Updated dependencies [f14a898]
- cssnano-preset-default@7.0.5
7.0.4
Patch Changes
- cssnano-preset-default@7.0.4
7.0.3
Patch Changes
- Updated dependencies [0c85fa9]
- Updated dependencies [13fb841]
- Updated dependencies [08989b0]
- cssnano-preset-default@7.0.3
7.0.2
Patch Changes
- cssnano-preset-default@7.0.2
7.0.1
Patch Changes
- Updated dependencies [2a26e29]
- cssnano-preset-default@7.0.1
7.0.0
Major Changes
- 0d10597: chore: drop support for Node.js 14 and 16
Patch Changes
- Updated dependencies [0d10597]
- cssnano-preset-default@7.0.0
6.1.2
Patch Changes
- fix(cssnano-preset-default): update css-declaration-sorter
- 2f3fb50: chore: update autoprefixer
- Updated dependencies
- cssnano-preset-default@6.1.2
6.1.1
Patch Changes
- cssnano-preset-default@6.1.1
6.1.0
Minor Changes
- feat: add preset and plugin options for browserslist
Patch Changes
- fix(cssnano): prevent crash when first preset is already invoked
- enable “go to definition” via declaration maps
- fix: add missing type declarations to plugins with options
- Updated dependencies
- cssnano-preset-default@6.1.0
6.0.5
Patch Changes
- 83d3268: chore: update autoprefixer and browerslist
- cssnano-preset-default@6.0.5
6.0.4
Patch Changes
- 311eaee: fix(cssnano): set minimum lilconfig version to one without vulnerabilities
- cssnano-preset-default@6.0.4
6.0.3
Patch Changes
- 26bbbd3: chore: update minimum browserslist version to 4.22.2
- 26bbbd3: chore: update postcss-selector-parser to 6.0.13
- Updated dependencies [9c6b0bc]
- cssnano-preset-default@6.0.3
6.0.2
Patch Changes
- 18331a6: fix: update cssnano peer dependency to 8.4.31 to avoid security issue
- 18331a6: fix: update postcss-calc to 9.0.1 to solve disappearing expressions inside two brackets
- 18331a6: deps(postcss-svgo): update SVGO to 3.0.5 and update doc
- 18331a6: chore: update css-declaration-sorter
- 18331a6: fix(postcss-minify-selectors): prevent mangling of timeline range names
- 18331a6: fix(postcss-convert-values): keep percent unit in @Property
- 18331a6: chore(cssnano): update lilconfig to 3.0.0
- Updated dependencies [18331a6]
- cssnano-preset-default@6.0.2
6.0.1
Patch Changes
- chore: updage postcss-calc to version 9
- fix(postcss-merge-rules): do not merge nested rules
- Updated dependencies
- cssnano-preset-default@6.0.1
6.0.0
Major Changes
- 39a20405: feat!(cssnano): remove yaml config support
- ca9d3f55: Switch minimum supported Node version to 14 for all packages
Patch Changes
- Updated dependencies [ca9d3f55]
- Updated dependencies [ca9d3f55]
- cssnano-preset-default@6.0.0
5.1.15
Patch Changes
- fix(postcsss-reduce-initial): fix mask-repeat conversion fix(postcss-colormin): don’t minify colors in src declarations fix(postcss-merge-rules): do not merge conflicting flex and border properties
- Updated dependencies
- cssnano-preset-default@5.2.14
5.1.14
Patch Changes
- fix: update autoprefixer and browserslist
- fix(postcss-reduce-initial): improve initial properties data
- Updated dependencies
- cssnano-preset-default@5.2.13
5.1.13
Patch Changes
- fix(cssnano): correct return type of cssnano() call
5.1.12
Patch Changes
- fix: preserve hyphenated property case
- fix: ensure sorting properties does not break the output
- fix: recognize ‘constant’ as a function
- Updated dependencies
- cssnano-preset-default@5.2.12
5.1.11
Patch Changes
- fix: preserve constant values
- Updated dependencies
- cssnano-preset-default@5.2.11
5.1.10
Patch Changes
- chore: update TypeScript and improve types
- fix: preserve similar nested selectors
- Updated dependencies
- cssnano-preset-default@5.2.10
5.1.9
Patch Changes
- fix: preserve more color function fallbacks
- Updated dependencies
- cssnano-preset-default@5.2.9
5.1.8
Patch Changes
- postcss-convert-values: preserve percentage sign on IE 11
- postcss-minify-params: refactor
- Updated dependencies
- cssnano-preset-default@5.2.8
5.1.7
Patch Changes
- fix: update postcss-merge-longhand. It was skipped by mistake in the previous release.
- Updated dependencies
- cssnano-preset-default@5.2.7
5.1.6
Patch Changes
- fix: preserve border color when merging border properties
- Updated dependencies
- cssnano-preset-default@5.2.6
5.1.5
Patch Changes
- fix: correct package.json dependency version specifier
- Updated dependencies
- cssnano-preset-default@5.2.5
5.1.4
Patch Changes
- fix: preserve custom property case
- Updated dependencies
- cssnano-preset-default@5.2.4
5.1.3
Patch Changes
- fix: do not merge declarations containing custom properties when it might create invalid declarations
- Updated dependencies
- cssnano-preset-default@5.2.3
5.1.2
Patch Changes
- fix: preserve empty custom properties and ensure they work in Chrome
- Updated dependencies
- cssnano-preset-default@5.2.2
5.1.1
Patch Changes
- fix: remove comments with PostCSS 8.4.6 and greater
- Updated dependencies
- cssnano-preset-default@5.2.1
5.1.0
Minor Changes
- feature: add TypeScript type declarations
Patch Changes
- Updated dependencies
- cssnano-preset-default@5.2.0
5.0.17
Patch Changes
- Publish untranspiled CommonJS source
- Updated dependencies
- cssnano-preset-default@5.1.12
5.0.16
Patch Changes
- refactor: replace natural sort with built-in array sort
- Updated dependencies
- cssnano-preset-default@5.1.11
5.0.15
Patch Changes
-
refactor: remove getMatch function from cssnano-utils
The getMatch function allows nested arrays to emulate a map. It is better to replace this function with a regular Map(). It’s unlikely this function is used outside of cssnano as it requires a very specific nested array struture.
-
fix: update postcss-calc to 8.2
Remove a crash when postcss-calc cannot parse the value
-
Updated dependencies
- cssnano-preset-default@5.1.10
5.0.14 (2021-12-20)
Bug fixes
- fix(cssnano): correctly resolve presets in pnpm monorepo (#1269) (6f9c7477eb)
5.0.13 (2021-12-16)
Patch Changes
- chore(postcss-normalize-url): reduce dependencies (#1255)(a4267dedcd6)
- fix(postcss-colormin): accept configuration options (#1263)(3b38038007)
- Updated dependencies
- cssnano-preset-default@5.1.9
5.0.12 (2021-11-27)
Bug fixes
- fix(postcss-reduce-initial): update initial values data (#1242) (c6e9f00b785)
- Updated dependencies
- cssnano-preset-default@5.1.8
5.0.11 (2021-11-16)
Bug fixes
- c38f14c3ce3d0: postcss-normalize-url: avoid changing parameter encoding
Chore
- 31d5c07dc07a4: refactor: drop one-liner dependencies
- 07172825ffbb4f4: postcss-merge-longhand: drop css-color-names dependency
5.0.10 (2021-11-05)
Bug fixes
5.0.9 (2021-11-01)
Bug fixes
-
postcss-svgo: normalize SVG with escaped quote characters (#1200) (4ef5e41)
-
postcss-convert-values: preserve percentage-only properties (#1212) (8f3453)
-
postcss-minify-gradients: handle 2 color-stop-length in linear gradient (#1215) (8bb7ba6c)
-
cssnano-preset-advanced: update autoprefixer (#1213) (f19932)
Chore
5.0.8 (2021-08-18)
Chore
5.0.7 (2021-07-21)
Bug fixes
- cssnano: reduce dependencies by moving from cosmiconfig to lilconfig (#1168) (506a8232)
5.0.6 (2021-06-09)
Bug Fixes
postcss-normalize-url: bump normalize-url dependency to 6.0.1 (#1142) (b60f54bed)
postcss-ordered-values: preserve columns count (#1144) (9acd6a2fe3e)
5.0.5 (2021-05-28)
Bug fixes
- Preserve alpha channel in color minification
- Check overlaps more exhaustively when merging rules
- Do not crash when the input CSS contains relative URLs
5.0.4 (2021-05-21)
Bug Fixes
- postcss-colormin: Strict color parsing (#1122) (32771da)
- postcss-colormin: fix ERR_PACKAGE_PATH_NOT_EXPORTED (#1110) (8a31ca38796)
5.0.3 (2021-05-19)
Bug Fixes
- cssnano: many bug fixes in dependent packages. Most notably fixed buggy reordering of border declarations and improved color value minification. See the changelogs for the single presets and plugins for details.
5.0.2 (2021-04-26)
Bug Fixes
5.0.1 (2021-04-13)
Bug Fixes
5.0.0 (2021-04-06)
Note: Version bump only for package cssnano
5.0.0-rc.2 (2021-03-15)
Bug Fixes
- update SVGO (aa07cfd)
5.0.0-rc.1 (2021-03-04)
Note: Version bump only for package cssnano
5.0.0-rc.0 (2021-02-19)
Bug Fixes
- postcss-ordered-values: columns transform returning string instead of the AST (#928) (a5d6d36)
- unique-selector: removed sorting and involving selector comments (#857) (3fa875d)
chore
Features
- css declaration sorter (#855) (613d562)
- migrate to PostCSS 8 (#975) (40b82dc)
- postcss-reduce-transforms: improve optimizations (#745) (b0f0d89)
BREAKING CHANGES
- minimum supported
postcssversion is8.2.1 - minimum require version of node is 10.13
4.1.10 (2019-02-14)
4.1.9 (2019-02-12)
Bug Fixes
4.1.7 (2018-10-22)
4.1.6 (2018-10-22)
4.1.5 (2018-10-17)
Bug Fixes
4.1.4 (2018-09-27)
4.1.3 (2018-09-25)
4.1.2 (2018-09-25)
4.1.1 (2018-09-24)
Bug Fixes
4.1.0 (2018-08-24)
4.0.5 (2018-07-30)
4.0.4 (2018-07-25)
4.0.3 (2018-07-18)
Bug Fixes
4.1.10
Bug Fixes
stylehacksdoes not throw error on[attr]selector
4.1.9
Performance Improvements
postcss-colormin: increase performancepostcss-discard-comments: increase performancepostcss-merge-rulesincrease performancepostcss-minify-paramsincrease performancepostcss-minify-selectors: increase performancepostcss-normalize-display-values: increase performancepostcss-normalize-positions: increase performancepostcss-normalize-repeat-style: increase performancepostcss-normalize-string: increase performancepostcss-normalize-timing-functions: increase performancepostcss-normalize-whitespace: increase performancepostcss-ordered-values: increase performancepostcss-reduce-transforms: increase performancepostcss-svgo: increase performance
Bug Fixes
postcss-merge-longhandhandle uppercase properties and valuespostcss-minify-gradientshandle uppercase properties and valuespostcss-minify-paramsdo break@pagerulespostcss-reduce-identshandle uppercase at-rulespostcss-reduce-initialnow usesrepeatas initial value formask-repeatpostcss-reduce-initialhandle uppercase value when you convert to initialstylehackshandle uppercase properties and values
4.1.8
Performance Improvements
- initial loading time (
require('cssnano')).
Bug Fixes
postcss-merge-longhandcorrectly merging border properties with custom properties.
4.1.7
Bug Fixes
- republish
cssnanodue broken release.
4.1.6
Bug Fixes
postcss-merge-longhanddoesn’t throw error when merge a border property.
4.1.5
Bug Fixes
cssnanonow allow to toggling of plugins in presets using boolean configuration option.postcss-merge-longhanddoesn’t merge properties withunset.postcss-merge-longhandcorrectly merge borders with custom properties.postcss-merge-longhanddoesn’t merge redundant values if declarations are of different importance.
Other changes
postcss-calcupdated to7.0.0version.
4.1.4
Other changes
css-declaration-sorternow use PostCSS 7.postcss-calcnow use PostCSS 7.
4.1.3
Other changes
postcss-minify-font-valuesnow use PostCSS 7.postcss-discard-duplicatesnow use PostCSS 7.
4.1.2
Bug Fixes
postcss-svgonow handle DataURI with uppercasedatavalue (DATA:image/*;...).
4.1.1
Bug Fixes
css-declaration-sorterwas removed from default prevent.postcss-normalize-timing-functionsdoesn’t lowercased property anymore.postcss-normalize-positonsnow handles uppercase properties.postcss-normalize-urlnow is case-insensitive.postcss-merge-identsnow is case-insensitive.postcss-merge-rulesnow is case-insensitive.postcss-minify-selectorsnow is case-insensitive.postcss-minify-font-valuesnow is case-insensitive.postcss-normalize-unicodenow has correct dependencies.postcss-minify-paramsnow has correct dependencies.
Other changes
cssnano-preset-advanceduse Autoprefixer 9.- use PostCSS 7 in all plugins.
4.1.0
Bug Fixes
postcss-merge-longhanddoesn’t mangle borders.
Features
postcss-ordered-valuessupport ordering animation values.
4.0.5
Bug Fixes
postcss-merge-longhandnow correctly merges borders with custom properties.postcss-merge-longhanddoesn’t throw error in somebordermerge cases.
4.0.4
Bug Fixes
postcss-merge-longhanddoesn’t drop border-width with custom property from border shorthand.postcss-merge-longhanddoesn’t convertcurrentColor.postcss-merge-longhanddoesn’t merge border properties if there is a shorthand property between them.
4.0.3
Bug Fixes
postcss-merge-longhandincorrect minification ofborder(border-*) declarations.
4.0.2
Bug Fixes
postcss-merge-longhanddon’t explode declarations with custom properties.postcss-colorminnow better transform tohsl.
4.0.1
Bug Fixes
browserslistversion incompatibility withcaniuse-api.
4.0.0
Breaking changes
- We dropped support for Node 4, now requiring at least Node 6.9.
Features
- postcss-merge-longhand now optimises
border-spacingproperty.
Bug Fixes
- postcss-normalize-unicode doesn’t change
Uto lowercase forIE<= 11 andEdge<= 15. - postcss-merge-longhand works with custom properties (Example
a { border-style:dotted; border-style:var(--variable) }) correctly. - postcss-ordered-values handle
borderproperty with invalid border width value correctly. - postcss-merge-rules handles
:-ms-input-placeholderand::-ms-input-placeholderselectors correctly. - postcss-merge-rules works with
allproperty correctly. - postcss-normalize-url don’t handle empty
urlfunction. - postcss-normalize-url handles
dataand*-extension://URLs correctly. - postcss-colormin adds whitespace after minified value and before function.
- postcss-minify-font-values better escapes font name.
- postcss-minify-params doesn’t remove
allfor IE.
Other changes
- update all dependencies to latest.
- better handles uppercase selectors/properties/values/units.
4.0.0-rc.2
Features
- Includes the new release candidate for postcss-selector-parser 3.
- Refactors comments tokenizing in postcss-discard-comments to be more memory efficient.
- Adds css-declaration-sorter for improved gzip compression efficiencies (thanks to @Siilwyn).
- postcss-svgo now optimises base 64 encoded SVG where possible (thanks to @evilebottnawi).
- stylehacks now supports
@media \0screen\,screen\9 {}hacks (thanks to @evilebottnawi).
Bug Fixes
- Fixed handling of package.json configuration (thanks to @andyjansson).
- Fixed
resolveConfigfor aRootnode without asourceproperty (thanks to @darthmaim). - Improved radial gradient handling (thanks to @pigcan).
- stylehacks now properly accounts for vendor prefixes (thanks to @evilebottnawi).
4.0.0-rc.1
Bug Fixes
- cssnano: Resolved an issue with external configuration which wasn’t being loaded correctly (thanks to @andyjansson).
- postcss-minify-params: Resolved an issue with cssnano’s handling of the
@valuesyntax from css-modules to better integrate with css-loader.
4.0.0-rc.0
Since version 4 has been in-development for some time, we thought it would be best to release an alpha version so that we could catch any issues before the actual release.
Breaking changes
-
cssnano & its plugins have been upgraded to PostCSS 6.x. Please ensure that for optimal results that you use cssnano with a PostCSS 6 compatible runner & that any other plugins are also using PostCSS 6.
-
cssnano is now essentially a preset loader and does not contain any built-in transforms (instead, it delegates to
cssnano-preset-defaultby default). Due to the new architecture, it’s not possible to exclude asynchronous transforms and run it synchronously, unlike in 3.x. Any transforms that were “core” modules have now been extracted out into separate packages. -
Because of the new preset system, cssnano will not accept any transformation options; these must be set in the preset. The option names remain mostly the same, except some cases where “core” modules have been extracted out:
coreis nownormalizeWhitespace.reduceBackgroundRepeatis nownormalizeRepeatStyle.reduceDisplayValuesis nownormalizeDisplayValues.reducePositionsis nownormalizePositions.reduceTimingFunctionsis nownormalizeTimingFunctions.styleCacheis nowrawCache.
When excluding transforms, we now have an
excludeoption (in 3.x this was nameddisable). Similarly, thesafeoption was removed; the defaults are now much less aggressive. -
By default, the following transforms are no longer applied to any input CSS. You may see an increased output file size as a result:
autoprefixerpostcss-discard-unusedpostcss-merge-identspostcss-reduce-identspostcss-zindex
Note that you can load
cssnano-preset-advancedinstead which does contain these transforms. -
We no longer detect previous plugins to silently exclude our own, and now consider this to be an anti-pattern. So
postcss-filter-pluginswas removed. -
We also changed some options to make the default transforms safer:
postcss-minify-font-values:removeAfterKeywordset tofalsefromtrue.postcss-normalize-url:stripWWWset tofalsefromtrue.
-
cssnano now does not accept the
sourcemapshortcut option; please refer to the PostCSS documentation on sourcemaps. Thequickstart.jsfile included with this module will give you a good starting point. -
cssnano.processis no longer a custom method; we use the built-inprocessmethod exposed on each PostCSS plugin. The new signature iscssnano.process(css, postcssOpts, cssnanoOpts), in 3.x it wascssnano.process(css, cssnanoOpts). -
We dropped support for Node 0.12, now requiring at least Node 4.
-
Finally, cssnano is now developed as a monorepo, due to the fact that some transforms have a lot of grey area/overlap. Due to this, some modules have been refactored to delegate responsibility to others, such that duplication of functionality is minimized. For instance,
postcss-colorminwill no longer compress whitespace or compress numbers, as those are handled bypostcss-normalize-whitespace&postcss-convert-valuesrespectively.
Other changes
- Due to the PostCSS 6 upgrade, we have been able to reduce usage of custom
methods, such as node
clonebehaviour. In cases where some utility has been used by several plugins it is now a separate package, reducing cssnano’s footprint. - cssnano now makes much better use of Browserslist.
postcss-colormin&postcss-reduce-initialwere enhanced with different behaviour depending on which browsers are passed. And now, the footprint for thecaniuse-dbdependency is much smaller thanks tocaniuse-lite- 7 times smaller as of this writing. This makes cssnano much faster to download from npm!
3.10.0
- cssnano will no longer
console.warnany messages when using deprecated options; these are now sent to PostCSS. You will be able to see them if you use a PostCSS runner with built-in messages support, or alternately by loadingpostcss-reporterorpostcss-browser-reporterin your plugins list. - Prepares support for
grididentifier reduction by adding it to the list of optimisations turned off whenoptions.safeis set totrue. - Adds support for normalizing
unicode-rangedescriptors. Values will be converted when the code matches0&fin the same place on both sides of the range. So,u+2000-2fffcan be converted tou+2???, butu+2100-2fffwill be left as it is.
3.9.1
- Resolves an integration issue with
v3.9.0, whereundefinedvalues would attempt to be parsed.
3.9.0
- Adds a new option to normalize wrapping quotes for strings & joining multiple-line strings into a single line. This optimisation can potentially reduce the final gzipped size of your CSS file.
3.8.2
- Resolves an issue where
display: list-item inline flowwould be normalized toinline list-itemrather thaninline-list-item(thanks to @mattbasta).
3.8.1
- Adds a quick start file for easy integration with Runkit. Try cssnano online at https://runkit.com/npm/cssnano.
3.8.0
- Adds support for normalizing multiple values for the
displayproperty. For exampleblock flowcan be simplified toblock.
3.7.7
- Further improves CSS mixin handling; semicolons will no longer be stripped from rules as well as declarations.
3.7.6
- Resolves an issue where the semicolon was being incorrectly stripped from CSS mixins.
3.7.5
- Resolves an issue where the
safeflag was not being persisted across multiple files (thanks to @techmatt101).
3.7.4
- Improves performance of the reducePositions transform by testing
against
hasOwnPropertyinstead of using an array of object keys. - Removes the redundant
indexes-ofdependency.
3.7.3
- Unpins postcss-filter-plugins from
2.0.0as a fix has landed in the new version of uniqid.
3.7.2
- Temporarily pins postcss-filter-plugins to version
2.0.0in order to mitigate an issue with uniqid3.0.0.
3.7.1
- Enabling safe mode now turns off both postcss-merge-idents &
postcss-normalize-url’s
stripWWWoption.
3.7.0
- Added: Reduce
background-repeatdefinitions; works with both this property & thebackgroundshorthand, and aims to compress the extended two value syntax into the single value syntax. - Added: Reduce
initialvalues for properties when the actual initial value is shorter; for example,min-width: initialbecomesmin-width: 0.
3.6.2
- Fixed an issue where cssnano would crash on
steps(1).
3.6.1
- Fixed an issue where cssnano would crash on
stepsfunctions with a single argument.
3.6.0
- Added
postcss-discard-overriddento safely discard overridden rules with the same identifier (thanks to @Justineo). - Added: Reduce animation/transition timing functions. Detects
cubic-bezierfunctions that are equivalent to the timing keywords and compresses, as well as normalizing thestepstiming function. - Added the
perspective-originproperty to the list of supported properties transformed by thereduce-positionstransform.
3.5.2
- Resolves an issue where the 3 or 4 value syntax for
background-positionwere being incorrectly converted.
3.5.1
- Improves checking for
background-positionvalues in thebackgroundshorthand property.
3.5.0
- Adds a new optimisation path which can minimise keyword values for
background-positionand thebackgroundshorthand. - Tweaks to performance in the
coremodule, now performs less AST passes. - Now compiled with Babel 6.
3.4.0
- Adds a new optimisation path which can minimise gradient parameters automatically.
3.3.2
- Fixes an issue where using
options.safethrew an error when cssnano was not used as part of a PostCSS instance, but standalone (such as in modules like gulp-cssnano). cssnano now renamessafeinternally toisSafe.
3.3.1
- Unpins postcss-colormin from
2.1.2, as the2.1.3&2.1.4patches had optimization regressions that are now resolved in2.1.5.
3.3.0
- Updated modules to use postcss-value-parser version 3 (thanks to @TrySound).
- Now converts between transform functions with postcss-reduce-transforms.
e.g.
translate3d(0, 0, 0)becomestranslateZ(0).
3.2.0
- cssnano no longer converts
outline: nonetooutline: 0, as there are some cases where the values are not equivalent (thanks to @TrySound). - cssnano no longer converts for example
16pxto1pcby default. Length optimisations can be turned on via{convertValues: {length: true}}. - Improved minimization of css functions (thanks to @TrySound).
3.1.0
- This release swaps postcss-single-charset for postcss-normalize-charset,
which can detect encoding to determine whether a charset is necessary.
Optionally, you can set the
addoption totrueto prepend a UTF-8 charset to the output automatically (thanks to @TrySound). - A
safeoption was added, which disables more aggressive optimisations, as a convenient preset configuration (thanks to @TrySound). - Added an option to convert from
degtoturn& vice versa, & improved minification performance in functions (thanks to @TrySound).
3.0.3
- Fixes an issue where cssnano was removing spaces around forward slashes in string literals (thanks to @TrySound).
3.0.2
- Fixes an issue where cssnano was removing spaces around forward slashes in calc functions.
3.0.1
- Replaced css-list & balanced-match with postcss-value-parser, reducing the module’s overall size (thanks to @TrySound).
3.0.0
- All cssnano plugins and cssnano itself have migrated to PostCSS 5.x. Please make sure that when using the 3.x releases that you use a 5.x compatible PostCSS runner.
- cssnano will now compress inline SVG through SVGO. Because of this change,
interfacing with cssnano must now be done through an asynchronous API. The
main
processmethod has the same signature as a PostCSS processor instance. - The old options such as
merge&fontsthat were deprecated in release2.5.0were removed. The new architecture allows you to specify any module name to disable it. - postcss-minify-selectors’ at-rule compression was extracted out into postcss-minify-params (thanks to @TrySound).
- Overall performance of the module has improved dramatically, thanks to work by @TrySound and input from the community.
- Improved selector merging/deduplication in certain use cases.
- cssnano no longer compresses hex colours in filter properties, to better support old versions of Internet Explorer (thanks to @faddee).
- cssnano will not merge properties together that have an
inheritkeyword. - postcss-minify-font-weight & postcss-font-family were consolidated into postcss-minify-font-values. Using the old options will print deprecation warnings (thanks to @TrySound).
- The cssnano CLI was extracted into a separate module, so that dependent modules such as gulp-cssnano don’t download unnecessary extras.
2.6.1
- Improved performance of the core module
functionOptimiser.
2.6.0
- Adds a new optimisation which re-orders properties that accept values in an arbitrary order. This can lead to improved merging behaviour in certain cases.
2.5.0
- Adds support for disabling modules of the user’s choosing, with new option
names. The old options (such as
merge&fonts) will be removed in3.0.
2.4.0
- postcss-minify-selectors was extended to add support for conversion of
::beforeto:before; this release removes the dedicated postcss-pseudoelements module.
2.3.0
- Consolidated postcss-minify-trbl & two integrated modules into postcss-merge-longhand.
2.2.0
- Replaced integrated plugin filter with postcss-filter-plugins.
- Improved rule merging logic.
- Improved performance across the board by reducing AST iterations where it was possible to do so.
- cssnano will now perform better whitespace compression when used with other PostCSS plugins.
2.1.1
- Fixes an issue where options were not passed to normalize-url.
2.1.0
- Allow
postcss-font-familyto be disabled.
2.0.3
- cssnano can now be consumed with the parentheses-less method in PostCSS; e.g.
postcss([ cssnano ]). - Fixes an issue where ‘Din’ was being picked up by the logic as a numeric value, causing the full font name to be incorrectly rearranged.
2.0.2
- Extract trbl value reducing into a separate module.
- Refactor core longhand optimiser to not rely on trbl cache.
- Adds support for
chunits; previously they were removed. - Fixes parsing of some selector hacks.
- Fixes an issue where embedded base 64 data was being converted as if it were a URL.
2.0.1
- Add
postcss-pluginkeyword to package.json. - Wraps all core processors with the PostCSS 4.1 plugin API.
2.0.0
- Adds removal of outdated vendor prefixes based on browser support.
- Addresses an issue where relative path separators were converted to backslashes on Windows.
- cssnano will now detect previous plugins and silently disable them when the functionality overlaps. This is to enable faster interoperation with cssnext.
- cssnano now exports as a PostCSS plugin. The simple interface is exposed
at
cssnano.process(css, opts)instead ofcssnano(css, opts). - Improved URL detection when using two or more in the same declaration.
- node 0.10 is no longer officially supported.
1.4.3
- Fixes incorrect minification of
background:nonetobackground:0 0.
1.4.2
- Fixes an issue with nested URLs inside
url()functions.
1.4.1
- Addresses an issue where whitespace removal after a CSS function would cause rendering issues in Internet Explorer.
1.4.0
- Adds support for removal of unused
@keyframesand@counter-styleat-rules. - comments: adds support for user-directed removal of comments, with the
removeoption (thanks to @dmitrykiselyov). - comments:
removeAllButFirstnow operates on each CSS tree, rather than the first one passed to cssnano.
1.3.3
- Fixes incorrect minification of
border:nonetoborder:0 0.
1.3.2
- Improved selector minifying logic, leading to better compression of attribute selectors.
- Improved comment discarding logic.
1.3.1
- Fixes crash on undefined
decl.beforefrom prior AST.
1.3.0
- Added support for bundling cssnano using webpack (thanks to @MoOx).
1.2.1
- Fixed a bug where a CSS function keyword inside its value would throw an error.
1.2.0
- Better support for merging properties without the existance of a shorthand override.
- Can now ‘merge forward’ adjacent rules as well as the previous ‘merge behind’ behaviour, leading to better compression.
- Selector re-ordering now happens last in the chain of plugins, to help clean up merged selectors.
1.1.0
- Now can merge identifiers such as
@keyframesand@counter-styleif they have duplicated properties but are named differently. - Fixes an issue where duplicated keyframes with the same name would cause an infinite loop.
1.0.2
- Improve module loading logic (thanks to @tunnckoCore).
- Improve minification of numeric values, with better support for
rem, trailing zeroes and slash/comma separated values (thanks to @TrySound & @tunnckoCore). - Fixed an issue where
-webkit-tap-highlight-colorvalues were being incorrectly transformed totransparent. This is not supported in Safari. - Added support for viewport units (thanks to @TrySound).
- Add MIT license file.
1.0.1
- Add repository/author links to package.json.
1.0.0
- Initial release.