Google Chrome DevTools just got way better for SEOs, Developers and basically anyone who wants to minimize their site’s page load times. As of Chrome 59, the development console in your favorite browser has a new feature called “Coverage”. While the title sounds fairly plain Jane, the functionality is a godsend for anyone who has the task of optimizing a complex or bloated WordPress website by allowing you to segment all of the unused JavaScript & CSS that any given page is loading; making code optimization and PageSpeed scores substantially easier to improve.
Here are the details from the Google Developers site:
CSS & JS Code Coverage
Find unused CSS and JS code with the new Coverage tab. When you load or run a page, the tab tells you how much code was used, versus how much was loaded. You can reduce the size of your pages by only shipping the code that you need.
Figure 1. The Coverage tab
Clicking on a URL reveals that file in the Sources panel with a breakdown of which lines of code executed.
Figure 2. A breakdown of code coverage in the Sources panel
Each line of code is color-coded:
- Solid green means that line of code executed.
- Solid red means it did not execute.
- A line of code that is both red and green, such as line 3 in Figure 2, means that only some code on that line executed. For example, a ternary expression like
var b = (a > 0) ? a : 0
is colored both red and green.
To open the Coverage tab:
- Open the Command Menu.(Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows, Linux).)
- Start typing
Coverage
and select Show Coverage.