From the course: CSS: Refactoring Style Sheets

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Quarantine unused code

Quarantine unused code - CSS Tutorial

From the course: CSS: Refactoring Style Sheets

Start my 1-month free trial

Quarantine unused code

- [Instructor] Using coverage in the developer tools in Chrome for our CSS, we can identify exactly what style rules are in use and which are just taking up valuable download resources. In this example, you can see that list is quite extensive. But here comes the tricky part. This coverage feature is not 100% accurate. For example, it may well mark code wrapped in a media query as unused even though it would be used if the query was met. It also might mark CSS triggered by JavaScript as unused even though it would be used if some event occurs to trigger that JavaScript. And as you saw in the previous movie, it marks things like hover-states and focus-states, and everything else as unused, because as the coverage test is taking place we're not hovering or focusing on anything. So, you can't use this red line on the left-hand side here as an absolute marker telling you, this code is not in use. This is a guiding point, telling you this code might not be in use. And you need to test to…

Contents