Is Minifying CSS Necessary? (2023)
31 points by uncenter
31 points by uncenter
You’re not allowed to make a performance argument like that unless you’re on some type of extremely limited embedded hardware or something. Especially when you are serving MBs of JavaScript. Gzip is good enough for over the wire size, and if parsing whitespace has got to be so close to free that it’s not going to be a problem. I say this from the top of my head, and it seems like the article back that up with data.
I don't have a stance on minifying CSS specifically, but extremely limited hardware is much more common than one might imagine. Billions of people exclusively access the internet through very under-powered and often old mobile phones with very limited bandwidth and monthly data quotas. I want my websites to work for them just as well as they do for people in wealthy countries.
But also, no amount of asset minification is going to make the gargantuan SPAs that took over the web run well on an underpowered device, so it is a wash either way, IMHO.
Another class of devices are things like e-ink devices. You can be in the Western world and still be using an absolute toaster of a machine to render a webpage!
Minifying CSS has another use case: fair comparison of small stylesheets. E.g. minifying the stylesheets from https://dohliam.github.io/dropin-minimal-css/ is a fairer comparison. That way if a stylesheet looks "big", but has lots of comments, that is good, and shouldn't be considered "big". OTOH if after minification one stylesheet is significantly larger than the other then you have to see whether it offers you any features you'd actually need to use.
And a small stylesheet will likely also have fewer rules. Even better if you can (automatically) drop CSS rules that your HTML doesn't use at all.
Sure that is not purely textual minification anymore, but it can help reduce and manage complexity. If you're the kind of person that cares about the size of the (minified) stylesheet then it can help avoid making the stylesheets more complicated than necessary. And that can be good not just for performance, but also for future maintenance overhead.