Purgecss is a really cool tool for removing unused CSS based on an analysis of your HTML. For example, unused classes.
https://www.purgecss.com/
This gives CSS libraries much more scope to add features without hurting bundle size!
Are there many good static analysis tools for CSS?
I have website projects in both Django and Express that almost certainly have unused rules due to unused classes.
"it’s safer to add or remove classes on a specific HTML node than to add or remove styles in a class that applies on many elements"
A defence of utility-first CSS, and how semantic classes can convey less information:
If function f1 is unused, and f2 is only called from f1, Rust complains that both f1 and f2 are unused.
I find this confusing: it's useful to know that I can remove both functions, but removing f2 alone gives a compile error.
Not sure what the best tradeoff is though.