stylehacks
does not throw error on [attr]
selectorpostcss-colormin
: increase performancepostcss-discard-comments
: increase performancepostcss-merge-rules
increase performancepostcss-minify-params
increase 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 performancepostcss-merge-longhand
handle uppercase properties and valuespostcss-minify-gradients
handle uppercase properties and valuespostcss-minify-params
do break @page
rulespostcss-reduce-idents
handle uppercase at-rulespostcss-reduce-initial
now uses repeat
as initial value for mask-repeat
postcss-reduce-initial
handle uppercase value when you convert to initialstylehacks
handle uppercase properties and valuesrequire('cssnano')
).postcss-merge-longhand
correctly merging border properties with custom properties.cssnano
due broken release.postcss-merge-longhand
doesn't throw error when merge a border property.cssnano
now allow to toggling of plugins in presets using boolean configuration option.postcss-merge-longhand
doesn't merge properties with unset
.postcss-merge-longhand
correctly merge borders with custom properties.postcss-merge-longhand
doesn't merge redundant values if declarations are of different importance.postcss-calc
updated to 7.0.0
version.css-declaration-sorter
now use PostCSS 7.postcss-calc
now use PostCSS 7.postcss-minify-font-values
now use PostCSS 7.postcss-discard-duplicates
now use PostCSS 7.postcss-svgo
now handle DataURI with uppercase data
value (DATA:image/*;...
).css-declaration-sorter
was removed from default prevent.postcss-normalize-timing-functions
doesn't lowercased property anymore.postcss-normalize-positons
now handles uppercase properties.postcss-normalize-url
now is case-insensitive.postcss-merge-idents
now is case-insensitive.postcss-merge-rules
now is case-insensitive.postcss-minify-selectors
now is case-insensitive.postcss-minify-font-values
now is case-insensitive.postcss-normalize-unicode
now has correct dependencies.postcss-minify-params
now has correct dependencies.cssnano-preset-advanced
use Autoprefixer 9.postcss-merge-longhand
doesn't mangle borders.postcss-ordered-values
support ordering animation values.postcss-merge-longhand
now correctly merges borders with custom properties.postcss-merge-longhand
doesn't throw error in some border
merge cases.postcss-merge-longhand
doesn't drop border-width with custom property from border shorthand.postcss-merge-longhand
doesn't convert currentColor
.postcss-merge-longhand
doesn't merge border properties if there is a shorthand property between them.postcss-merge-longhand
incorrect minification of border
(border-*
) declarations.postcss-merge-longhand
don't explode declarations with custom properties.postcss-colormin
now better transform to hsl
.browserslist
version incompatibility with caniuse-api
.border-spacing
property.U
to lowercase for IE
<= 11 and Edge
<= 15.a { border-style:dotted; border-style:var(--variable) }
) correctly.border
property with invalid border width value correctly.:-ms-input-placeholder
and ::-ms-input-placeholder
selectors correctly.all
property correctly.url
function.data
and *-extension://
URLs correctly.all
for IE.@media \0screen\,screen\9 {}
hacks
(thanks to @evilebottnawi).resolveConfig
for a Root
node without a source
property
(thanks to @darthmaim).@value
syntax from css-modules to better integrate with css-loader.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.
cssnano-preset-default
by 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:
core
is now normalizeWhitespace
.reduceBackgroundRepeat
is now normalizeRepeatStyle
.reduceDisplayValues
is now normalizeDisplayValues
.reducePositions
is now normalizePositions
.reduceTimingFunctions
is now normalizeTimingFunctions
.styleCache
is now rawCache
.When excluding transforms, we now have an exclude
option (in 3.x this was
named disable
). Similarly, the safe
option 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:
autoprefixer
postcss-discard-unused
postcss-merge-idents
postcss-reduce-idents
postcss-zindex
Note that you can load cssnano-preset-advanced
instead which does contain
these transforms.
postcss-filter-plugins
was removed.We also changed some options to make the default transforms safer:
postcss-minify-font-values
: removeAfterKeyword
set to false
from true
.postcss-normalize-url
: stripWWW
set to false
from true
.cssnano now does not accept the sourcemap
shortcut option; please refer
to the PostCSS documentation on sourcemaps. The quickstart.js
file included
with this module will give you a good starting point.
cssnano.process
is no longer a custom method; we use the built-in process
method exposed on each PostCSS plugin. The new signature is
cssnano.process(css, postcssOpts, cssnanoOpts)
, in 3.x it was
cssnano.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-colormin
will no
longer compress whitespace or compress numbers, as those are handled by
postcss-normalize-whitespace
& postcss-convert-values
respectively.
clone
behaviour. In cases where some utility
has been used by several plugins it is now a separate package, reducing
cssnano's footprint.postcss-colormin
&
postcss-reduce-initial
were enhanced with different behaviour depending
on which browsers are passed. And now, the footprint for the caniuse-db
dependency is much smaller thanks to caniuse-lite
- 7 times smaller as
of this writing. This makes cssnano much faster to download from npm!console.warn
any 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
loading postcss-reporter
or postcss-browser-reporter
in your plugins list.grid
identifier reduction by adding it to the list
of optimisations turned off when options.safe
is set to true
.unicode-range
descriptors. Values will
be converted when the code matches 0
& f
in the same place on both sides
of the range. So, u+2000-2fff
can be converted to u+2???
, but
u+2100-2fff
will be left as it is.v3.9.0
, where undefined
values
would attempt to be parsed.display: list-item inline flow
would be normalized
to inline list-item
rather than inline-list-item
(thanks to @mattbasta).display
property. For
example block flow
can be simplified to block
.safe
flag was not being persisted across
multiple files (thanks to @techmatt101).hasOwnProperty
instead of using an array of object keys.indexes-of
dependency.2.0.0
as a fix has landed in the new
version of uniqid.2.0.0
in order to
mitigate an issue with uniqid 3.0.0
.stripWWW
option.background-repeat
definitions; works with both this property
& the background
shorthand, and aims to compress the extended two value
syntax into the single value syntax.initial
values for properties when the actual initial value
is shorter; for example, min-width: initial
becomes min-width: 0
.steps(1)
.steps
functions with a
single argument.postcss-discard-overridden
to safely discard overridden rules with
the same identifier (thanks to @Justineo).cubic-bezier
functions that are equivalent to the timing keywords and compresses, as well
as normalizing the steps
timing function.perspective-origin
property to the list of supported properties
transformed by the reduce-positions
transform.background-position
were being incorrectly converted.background-position
values in the background
shorthand property.background-position
and the background
shorthand.core
module, now performs less AST passes.options.safe
threw an error when cssnano was
not used as part of a PostCSS instance, but standalone (such as in modules
like gulp-cssnano). cssnano now renames safe
internally to isSafe
.2.1.2
, as the 2.1.3
& 2.1.4
patches had
optimization regressions that are now resolved in 2.1.5
.translate3d(0, 0, 0)
becomes translateZ(0)
.outline: none
to outline: 0
, as there are
some cases where the values are not equivalent (thanks to @TrySound).16px
to 1pc
by default. Length
optimisations can be turned on via {convertValues: {length: true}}
.add
option to true
to prepend a UTF-8
charset to the output automatically (thanks to @TrySound).safe
option was added, which disables more aggressive optimisations, as
a convenient preset configuration (thanks to @TrySound).deg
to turn
& vice versa, & improved
minification performance in functions (thanks to @TrySound).process
method has the same signature as a PostCSS processor instance.merge
& fonts
that were deprecated in
release 2.5.0
were removed. The new architecture allows you to specify any
module name to disable it.inherit
keyword.functionOptimiser
.merge
& fonts
) will be removed in 3.0
.::before
to :before
; this release removes the dedicated
postcss-pseudoelements module.postcss-font-family
to be disabled.postcss([ cssnano ])
.ch
units; previously they were removed.postcss-plugin
keyword to package.json.cssnano.process(css, opts)
instead of cssnano(css, opts)
.background:none
to background:0 0
.url()
functions.@keyframes
and @counter-style
at-rules.remove
option (thanks to @dmitrykiselyov).removeAllButFirst
now operates on each CSS tree, rather than the
first one passed to cssnano.border:none
to border:0 0
.decl.before
from prior AST.@keyframes
and @counter-style
if they
have duplicated properties but are named differently.rem
,
trailing zeroes and slash/comma separated values
(thanks to @TrySound & @tunnckoCore).-webkit-tap-highlight-color
values were being
incorrectly transformed to transparent
. This is not supported in Safari.