Use updated version of clean-css

Is there any way of updating the version of clean-css that Ember uses? I can see that Ember uses: broccoli-clean-css which in turn uses clean-css-promise which in turn uses clean-css. However even with Ember 3.3.0 it seems to be using a version from 3 years ago. I tried doing yarn add broccoli-clean-css and yarn add clean-css which adds the latest versions to my node_modules - however these aren’t the versions that are actually used - which seems to be baked quite deeply into Ember.

What you’re encountering isn’t ember-specific, it’s how NPM works in general. Even if you could force a newer version of clean-css, it would almost certainly break, because clean-css has released breaking changes.

To figure out how to actually update, you need to see what is consuming it, and what is consuming that, etc. My preferred way is to use yarn why:

$ yarn why clean-css
yarn why v1.9.2
[1/4] 🤔  Why do we have the module "clean-css"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "clean-css@3.4.28"
info Reasons this module exists
   - "ember-cli#ember-cli-preprocess-registry#broccoli-clean-css#clean-css-promise" depends on it

Working backward from clean-css, I see there are already newer versions of clean-css-promise and broccoli-clean-css that would use the newest clean-css. That brings us to ember-cli-preprocess-registry, where the newest version has changed to not depend directly on clean-css (precisely to avoid the kind of issue we’re dealing with here, which is that its hard for an app to pick the exact preprocessors they want).

It looks like that version is not released and/or used by ember-cli, most likely because there’s some remaining work that nobody has been able to prioritize doing. You could ask here or here or here to see if there’s something you could do to push it over the line.

1 Like

Thanks Ed. That’s all useful information.
I’d not come across that yarn why command.

Cheers, Chris.