You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at cssnano docs I saw that it includes autoprefixer. So I thought, great, I don't need to include autoprefixer separately, cssnano will take care of adding all these prefixes. But when I tested it, it turned out that no prefixes get added.
After lots of debugging I finally saw the following lines in css-nano source code:
letdefaultOptions={autoprefixer: {add: false},
So that explains it... it's configured to only remove needless prefixes, but never add new ones. This makes sense for a minimizer, but it was contrary what I expected autoprefixer to do.
It would be really nice if this were documented. Also there are other plugins that are configured with similar defaults.
The text was updated successfully, but these errors were encountered:
I think naming the option autoprefixer was the mistake here. I'm looking to review what we bundle by default for v4, and at least we should look at changing the name.
Indeed, didn't notice this page as I actually discovered cssnano through Webpack css-loader plugin, which in its documentation linked the options page. For some reason I thought that's the main page of the manual and didn't look further.
In the end I decided to disable cssnano. The css-loader kind of magically enabled it, but I don't really care about these micro-optimizations. It caught us by surprise when some css suddenly started to misbehave when compilation was switched to production mode. Apparently some selectors got merged overly aggressively. (Disabling the merge-rules transform eliminated that issue.) However I haven't been able to reproduce the issue with cssnano alone. For some reason the aggressive optimization only happened within Webpack. Strange stuff...
Looking at cssnano docs I saw that it includes autoprefixer. So I thought, great, I don't need to include autoprefixer separately, cssnano will take care of adding all these prefixes. But when I tested it, it turned out that no prefixes get added.
After lots of debugging I finally saw the following lines in css-nano source code:
So that explains it... it's configured to only remove needless prefixes, but never add new ones. This makes sense for a minimizer, but it was contrary what I expected autoprefixer to do.
It would be really nice if this were documented. Also there are other plugins that are configured with similar defaults.
The text was updated successfully, but these errors were encountered: