Menu

Snippets

Yet another programmer blogging about code

postcss-clean breaks above postcss@8.1.10

If you use postcss-clean to drive clean-css as part of your build process, you need to pin postcss to no later than version 8.1.10 or you’ll get “TypeError: node.getIterator is not a function”.

When post-processing CSS to crunch it down to its minimum, I use the excellent clean-css by Jakub Pawlowicz. I drive it from postcss using postcss-clean.

Changes made to postcss in 2020 require changes in plugins. Until the author of postcss-clean is able to merge in a pull request that makes those changes, it’s best to pin postcss to no later than version 8.1.10 by setting an absolute version in package.json:

"devDependencies": {
    …
    "postcss": "8.1.10",
    "postcss-clean": "^1.1.0",
    …
  },

Other packages can get updates, while job is still done with clean-css.