Speed up your website with Chrome’s Coverage tool

Speed up your website with Chrome's Coverage Tool

Speed up your website by removing unused CSS from stylesheets. Use Chrome’s DevTools Coverage tool as a guide for what CSS to remove.

I found out about Coverage while reading the Lighthouse (web.dev) opportunity called Remove unused CSS and its description.

PageSpeed Insights - Remove unused CSS

Note: The screenshot shows an outdated way to get to Coverage. You have to go to DevTools -> More Tools -> Coverage to get to it.

DevTools Coverage tool screenshot 2019

According to Coverage, i wasn’t using 96.8% of my CSS stylesheet.css file and it was at a whopping 280kb! This was comprised of the full Bulma framework and my custom stylesheet combined into a single file. All the stuff in red is unused.

DevTools Coverage Full example

Finding what code i wasn’t using on a per page basis was easy; refactoring the code was time-consuming, but worth it. I use Gulp in my web development workflow, so i went from there and removed about a dozen Bulma files i didn’t need — dozens of classes and whatnot — and better minified and cleaned up my files.

As you can see below, my scores before removing a ton of unused CSS weren’t the best.

web.dev (Lighthouse) Performance Scores for macariojames.com

But after removing the unused CSS and tweaking all the Bulma stuff, the Performace Scores went up overall by six points. All four scores are green now and not the dismaying orange. I reduced my main CSS stylesheet from 280kb to 116kb! More than half the filesize. What’s remarkable is that i’m still not using 91% of the CSS.

Reduced CSS stylesheet down to 116kb from 280kb!

Note, removing the unused CSS wasn’t the only thing i did that helped my scores; i also took care of another issue — Eliminate render-blocking resources — by stopping a few scripts and other CSS stylesheets that were loading because of plugins.

web.dev (Lighthouse) Performance scores AFTER removing unused CSS

I wrote about disabling JavaScript and CSS added by WordPress plugins in the same week as this post. Check it out.

I hope this piece prompts you to look at the Coverage tool and use it help boost your Lighthouse scores.

If anything to add, do so below. Cheers and peace

(Visited 108 times, 1 visits today)

If you found this post useful ...

Buy Me a Coffee logo
Wondering why you keep seeing lower-cased 'i' in my posts? Read -> Why ‘i’ is not capitalized