Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the default configuration of the transforms that cssnano uses #169

Closed
nene opened this issue Apr 20, 2016 · 3 comments
Closed

Document the default configuration of the transforms that cssnano uses #169

nene opened this issue Apr 20, 2016 · 3 comments

Comments

@nene
Copy link

nene commented Apr 20, 2016

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:

let defaultOptions = {
    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.

@ben-eb ben-eb added this to the 4.0 milestone Apr 20, 2016
@ben-eb
Copy link
Collaborator

ben-eb commented Apr 20, 2016

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.

#88 (comment)

However this is documented in the optimisations section.

http://cssnano.co/optimisations/

@nene
Copy link
Author

nene commented Apr 20, 2016

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...

@ben-eb ben-eb removed this from the 4.0 milestone May 11, 2016
@ben-eb
Copy link
Collaborator

ben-eb commented May 11, 2016

The defaults are now properly documented;

Going to mark this as resolved. 4.0 breaking changes are tracked in #88.

@ben-eb ben-eb closed this as completed May 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants