CSS Style overload - Remove unused CSS Styles

by Keiron on October 23, 2007

I design sites (not well most of the time!) and often pinch bits and bobs from the various CSS stylesheets I’ve created over the years, generally I normally end up coming up with something that looks at least half decent!

However, all that cutting and pasting leaves my stylesheets in a mess - with tonnes of unused CSS styles!

I spotted a reference to Dust-Me Selectors today on San Baldo, and using this fantastic Firefox Extension I have managed, in the space of minutes to reduce on stylesheet from an unmanageable 600 lines to a mere 200!

It extracts all the selectors from all the stylesheets on the page you’re viewing, then analyzes that page to see which of those selectors are not used. The data is then stored in your user preferences, so that as you continue to navigate around a site, selectors will be crossed off the list as they’re encountered.

You’ll end up with a profile of which selectors are not used anywhere on the site.

Tag Me:
  • Digg
  • del.icio.us
  • Furl
  • StumbleUpon
  • Technorati
  • Sphinn
  • TwitThis

{ 7 comments… read them below or add one }

1 baldo 10.23.07 at 12:37 pm

thanks for reporting my post / blog :D

2 Keiron 10.23.07 at 12:55 pm

You’re welcome! It’s a fantastic little tool!

3 sujith 08.11.08 at 11:12 am

HI,
But this tool will help only to show the one unused in current page. It will be helpfull if it show unused css in thw whole site, becuase we will be able to delete tht classes from css….

4 Keiron 08.11.08 at 11:14 am

Hi Sujith,

I think the key is that you have to browse around the whole site with it.

5 sujith 08.11.08 at 11:28 am

Hi Keiron ,
Thanx. i too think thats the only work around. :-)

6 sam 09.02.08 at 12:02 pm

it has an option to spider your site, all you have to do is point it to the site map. i really cant believe how good this plugin is.
magic!!!!!

7 Keiron 09.02.08 at 1:18 pm

I haven’t seen that - is that in a new version?

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

The Slug! in Newcastle