Mudit Chauhan
Mudit Chauhan

Reputation: 81

Automatically remove un-used CSS classes from a project

I'd like to compare my CSS files with the classes that I'm actually using in the site, and generate a new CSS file that contains only those classes. The point being to get rid of classes that I'm not using.

I previously used the Dust Me Selectors extension for FireFox to find the used and unused CSS selectors but it doesn't work in FireFox 6 any more.

Are there any alternatives?

Upvotes: 7

Views: 1208

Answers (4)

Fabio Nolasco
Fabio Nolasco

Reputation: 7492

This system claim to do that: http://sourceforge.net/projects/cssmerge/?source=dlp

But I couldn't make it work, though.

So here it goes some manual tools to compare the files. It is not as fast as an automatic solution, but would make it faster than going by visual comparison alone.

http://www.diffchecker.com/

http://www.araxis.com/merge_mac/index.html

http://csscompare.codeplex.com/

Upvotes: 0

Mike Vierwind
Mike Vierwind

Reputation: 7009

When you put your site to GT-Metrix. Than you can see the un-used CSS selectors. Or you can do it with Google pagespeed.

Upvotes: 1

tomexx
tomexx

Reputation: 2329

You can try CSS Usage extension for Firebug. It works lika a charm, but it requires manual work https://addons.mozilla.org/en-US/firefox/addon/css-usage/

Upvotes: 0

Gatekeeper
Gatekeeper

Reputation: 1616

You can try this online tool or use Google Chrome's developer tool(installed by default, no extension needed), which has audits tab to display unused css selectors on current page... but i dont think there is a way to have it done automatically for you...

Upvotes: 0

Related Questions