So I stumbled upon this message in Google Page Speed Insights, that the current page I am optimising has a lot of unused CSS.
And I learned that Chrome offers a nice, easy way to see which CSS rules from the stylesheet are not applied in the page, but there is not such an easy way to remove these unused stylesheets on a per-URL basis: the Coverage Report.
Of course, there are some CLI tools that can scan your source files for CSS selectors, but in my opinion, doing it as a service would be more convenient.
It's 2020 and we should really not ship the styles for an entire website to EVERY web page. Of course, the browsers nowadays are able to cache the styles, but why not deliver only the CSS rules that the current page actually needs?
So this is why I decided to start https://splitcss.com
It will be an API that basically will return only the CSS that a certain URL needs.
The consumer can pass the URL where the HTML is, as well as the CSS URLs.
Lastly, the response will be cached and delivered to the consumer as either JSON or plain CSS which he can load, instead of loading the styles for the entire website.
What do you guys & girls think? Would you find it useful?
I'd love to hear your thoughts.