cssnano 5 is available

cssnano team ·

We have released a new major version of cssnano.

Major changes in cssnano 5

  • cssnano 5 requires Node.js >= 10.13
  • PostCSS 8 API (application programming interface), so cssnano 5 does not emit warnings when running under PostCSS 8
  • updates to SVGO (SVG Optimizer) 2, fixing many SVG (Scalable Vector Graphics) minification bugs
  • updates css-value-parser and css-selector-parser, fixing many bugs

How to upgrade

Update the PostCSS dependency

Add postcss to your package.json dependencies field, if your package manager does not install peer dependencies automatically.

JavaScript API changes

If you use the cssnano JavaScript API, change your code:

  • replace cssnano.process() with cssnano().process() (notice the () after cssnano)

  • pass cssnano options to cssnano() instead of process()

cssnano(cssnanoOptions).process(postcssOptions)

Bug fixes

  • fix improperly discarding @font-face declarations #726
  • partially fix some issues where cssnano did not combine rules when used together with postcss-nested #1004
  • fix translate3d() minification #920
  • fix minification of values starting with e #589, #984
  • fix minification of percentage values #962, #957
  • fix minification of aspect-ratio #963
  • fix merging of @supports rules #974
  • fix sorting of longhand and shorthand properties #535
  • remove vulnerable dependency and always warn with bad SVG input #1034