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

4.0.0-rc.1 doesn't seem to apply #385

Closed
guidobouman opened this issue Jul 13, 2017 · 2 comments
Closed

4.0.0-rc.1 doesn't seem to apply #385

guidobouman opened this issue Jul 13, 2017 · 2 comments

Comments

@guidobouman
Copy link

guidobouman commented Jul 13, 2017

Context: I'm using postcss combined with autoprefixer, cssnano and some other plugins within a webpack setup.

When switching from 3.10.x (packaged with css-loader) to 4.0.0-rc.1 I went from a 20% decrease to an 10% increase of my CSS... Any idea how that might be happening? Removed cssnano from my package.json for now, and all seems fine apart from the Node#moveTo was deprecated. Use Container#append. warning.

I'm on the latest postcss & postcss-loader, and run autoprefixer (together with other plugins) through it successfully.

PS: I do use the following config.

{
  discardUnused: {
    fontFace: false // Required for fonts.css
  }
}
@guidobouman guidobouman changed the title 4.0.0-rc.1 increase in file size vs 3.10.x 4.0.0-rc.1 increase in css size vs 3.10.x Jul 13, 2017
@guidobouman guidobouman changed the title 4.0.0-rc.1 increase in css size vs 3.10.x 4.0.0-rc.1 doesn't seem to apply Jul 13, 2017
@guidobouman
Copy link
Author

Hmm... After updating other packages it seems that 4.0.0-rc.1 doesn't seem to do anything at all.

Completely disabling cssnano in postcss gives the same 121KB for the largest stylesheet as with v4. When doing an npm i -D cssnano@latest my largest stylesheet goes pack to 99KB.

Oh, btw: with v4 installed:

➜  Nedwin.Portal.Statics git:(feature/webpack-entries) ✗ npm i -D cssnano@latest
+ cssnano@3.10.0
added 131 packages, removed 18 packages and updated 23 packages in 11.152s

That's a lot of extra packages, has v3 that much more dependencies than v4?

@ben-eb
Copy link
Collaborator

ben-eb commented Jul 13, 2017

Hi,

Yeah this is entirely possible as we do less by default; I think autoprefixer was a large contributor to space saved so as it has been removed then it's likely that vendor prefixes have returned to your CSS file. Overall I think the change is for the better for the defaults but you can always load the advanced preset which still retains this behaviour (with others). From the release notes:

By default, the following transforms are no longer applied to any input CSS.
You may see an increased output file size as a result:

  • autoprefixer
  • postcss-discard-unused
  • postcss-merge-idents
  • postcss-reduce-idents
  • postcss-zindex

Note that you can load cssnano-preset-advanced instead which does contain
these transforms.

Note that cssnano does not take any options any more, they are handled by each preset instead.

Yeah, it's also possible that 3.10.0 contains more dependencies, I did try and remove some and consolidate others with the new code. But I don't have a breakdown of what was removed other than the commit history I'm afraid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants