Possible Duplicate:
Tool to identify unused css definitions
Lets say I have a page displayed in my browser and I have a .CSS file used on this page with rules like
.class1{
/* some style definitions */
}
.class2{
/* some style definitions */
}
.class3{
/* some style definitions */
}
....
...
.class1001{
/* some style definitions */
}
Now my question is is there any addon which would tell me like out of these rules, which are "NOT USED" on the page..
I saw some related questions which provide links to addon that tell CSS selectors which are used on a page..But I have like 1000+ rules and hence want to directly know RULES which are NOT used..
JUST TO ADD, the addons mentioned have 1 issue; Like if there are hacks for IE (e.g. *html), it marks them as UNUSED, even though it is actually used in IE. Is there any workaround for this ?
Please help me. Thank you.
Next, click the settings icon > More tools > Coverage. After that, click the Reload button (the circle arrow icon). Filter the list that appears to only see JavaScript or CSS resources. Click any resource to see the used and unused code.
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. We will see buttons for start capturing coverage, to reload and start capturing coverage and to stop capturing coverage and show results.
If you want to remove unused CSS entirely, you can use a tool such as PurifyCSS to find out how much CSS file size can be reduced. Once you get the CSS code you should eliminate, you have to remove it manually from the page.
Simply right click and click Inspect Element. This will bring up the CSS selectors for that element.
If you use Firefox, you can use the Dust Me Selectors plugin that does exactly what you asked for. It finds unused Selectors for you :) Give it a try!
Also there is the CSS Usage plugin, that looks over your CSS file and tells you which ones are not being used. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With