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

CSS minification - no longer part of css-loader - should we add cssnano to nwb's default postcss-loader config? #467

Closed
insin opened this issue Jul 17, 2018 · 1 comment

Comments

@insin
Copy link
Owner

insin commented Jul 17, 2018

css-loader@1.0.0 no longer uses cssnano to minify CSS in production builds, do we want to add it back by adding cssnano to nwb's default PostCSS plugins?

Are there any potential issues with minifying CSS before it reaches css-loader?

Here's a small Bootstrap 3-using app with css-loader@1.0.0:

File sizes after gzip:

  dist\vendor.719d8810.js   47.65 KB
  dist\vendor.c100adf1.css  20.55 KB
  dist\app.222440ae.js      1001 B
  dist\Child2.b09783a1.js   632 B
  dist\Child3.3b34553d.js   570 B
  dist\Child1.3e7352a2.js   529 B
  dist\Child3.f672301d.css  109 B
  dist\Child2.1b04ae73.css  108 B
  dist\app.dd18676c.css     89 B

Here it is with cssnano({preset: 'default'}) as part of postcss-loader:

File sizes after gzip:

  dist\vendor.e8457d03.js   46.93 KB
  dist\vendor.c01d6bfd.css  19.08 KB
  dist\app.0c3ec42a.js      997 B
  dist\Child2.6c0a0ede.js   631 B
  dist\Child3.ba15e3f9.js   570 B
  dist\Child1.4104e1cd.js   528 B
  dist\Child3.41174980.css  98 B
  dist\Child2.da694fa7.css  97 B
  dist\app.66900423.css     81 B
@insin
Copy link
Owner Author

insin commented Aug 14, 2018

The mini-css-extract-plugin docs have some guidance on this:

https://github.com/webpack-contrib/mini-css-extract-plugin#minimizing-for-production

@insin insin self-assigned this Mar 12, 2020
@insin insin closed this as completed in 7fa2287 Mar 12, 2020
insin added a commit that referenced this issue Mar 12, 2020
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

1 participant