Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find unused CSS rules in a web app? [closed]

Tags:

html

css

windows

I have 10+ CSS files and around 30+ HTML/JSP files. I want to search each and every class/id in CSS files one by one in all HTML/JSP files so that can remove the rules which are not being used.

Is there any tool available to help in this?

I know there are Chrome/FF plugins to eliminate useless CSS rules but they only work for single page.

like image 433
coure2011 Avatar asked Feb 12 '13 07:02

coure2011


People also ask

How do I get unused CSS rules?

The Coverage tab in Chrome DevTools can help you find unused JavaScript and CSS code. Removing unused code can speed up your page load and save your mobile users cellular data.

How do I know if I have unused CSS classes?

Coverage Tab in Chrome DevTools (Manually) This Coverage tab helps us find unused Js and CSS code. Open your Chrome browser, go to “Developer Tools”, click on “More Tools” and then “Coverage”. A Coverage will open up.

How do I know if CSS is being used?

😬 Looking at “coverage” Chrome's DevTools has a “Coverage” tab that will tell you how much of your CSS and JavaScript is in use.


1 Answers

You can use this firefox plugin and this plugin for Chrome

They appear to do exactly that.

like image 173
Gunjan Karun Avatar answered Sep 24 '22 15:09

Gunjan Karun