-
Notifications
You must be signed in to change notification settings - Fork 0
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
Replace postcss-csso as minifier #23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Did you compare the bundle sizes with just minify instead of csso?
Hm, 116K for new module vs. 128K with CSSO. Didn't think there would be that big of a difference. |
I thought CSSO should be smaller given how they talk about "structural optimizations" etc. Glad that it wasn't the case. Less config and smaller bundle sizes. Nice! |
@joakim-lookback SORRY, it was the other way around :D CSSO → npm ls postcss-csso
[email protected] /Users/brookie/code/dashboard
└─┬ @lookback/[email protected]
└── [email protected] (git+ssh://[email protected]/lookback/postcss-csso.git#6cb7497ebb1c3788e2304267ac30b244f7809947)
→ ENV=production BUNDLE=1 npm run build:css
Finished src/css/index.css in 941 ms
→ s build/bundle.css
116K build/bundle.css
116K total New → npm ls @csstools/postcss-minify
[email protected] /Users/brookie/code/dashboard
└─┬ @lookback/[email protected] -> ./../lookbook
└── @csstools/[email protected]
→ ENV=production BUNDLE=1 npm run build:css
Finished src/css/index.css in 963 ms
→ s build/bundle.css
128K build/bundle.css
128K total |
PostCSS Minify clearly states it won't do transformations: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-minify
|
Right. I wonder if we should look into cssnano. It also fits right in into the postcss ecosystem and see if that will get us our bytes back. But then again, 10k, not much. It sure feels good to have a tool that is "focused on correctness and fidelity." 🙂 |
@joakim-lookback We used cssnano before but switched to CSSO :) I think the reason was breakage in cssnano too. |
Aha! Had no idea. But cssnano looks maintained where csso does not. Perhaps it works for our usecase now? |
How does this affect the minifiers in the projects? |
@joakim-lookback I checked out cssnano again, and it's a config hellhole... Loading presets and whatnot which explodes in dependencies. I just want a CSS minifier to be drop-in. Heard good things about http://lightningcss.dev. @lolgesten This is the central minifier for the CSS in all microsites. When we do |
Bundle in dashboard becomes 112K with cssnano with the "default" preset. But it does heavy transformations. |
Who doesn't like a config hellhole? Is that worth 16k? Idk, perhaps not? Interesting dilemma. Dependencies vs asset weight here. Will be interesting to see where @lolgesten lands on this one 😄 |
If using the default preset in cssnano, the deps aren't so bad. Since we only use it when bundling, it maybe is alright with heavy transformations. I mean, Typescript transpiles our TS source into unrecognizability in production anyway :) |
Minifying the main
|
main branch (csso ) |
cssnano |
postcss-minify |
---|---|---|
240K | 248K | 264K |
"LightningCSS doesn't use dependencies, we use RUST" 🔥 |
3997c72
to
49e5773
Compare
Ok, returning to this, I think we should go with the original minifier in this PR, I used it on the dashboard |
It's problematic, since it doesn't recognise at-rules such as @container and @starting-style. It's also quite unmaintained.