|
|
|
|
|
by consto
2870 days ago
|
|
I'm not convinced. Your problem was not that your CSS was 340 KBytes, but the simple fact you were using 5 CSS frameworks. And if you start removing unused styles at random, any time you want to work on the site and add features you may encounter edge cases where the style you want to use has been removed. And, if your CSS is used on multiple pages with different layouts, it looks like you will need to manually browse each one and merge the results. However, this is not to say that merging and compressing stylesheets is bad. If you do so then you can embed the style in the page to remove a render blocking resource and speed up your site. Then you can repeat the same process with Javascript. |
|
Generally, you'd want tools in your build pipeline that do this automatically (see my other post). Doing so solves all your objections. You're free to later use styles that you hadn't been using -- they're still there in the source CSS, so when you rebuild, they just don't get pruned out anymore. And those tools don't just analyze a single html file, they examine your entire source tree, so you don't have problems with styles used on some pages but not others.