views:

383

answers:

3

Hi,

It's not really a coding question, but I don't know where to ask it elsewhere.

I'm looking for a tool to clean up unused css selectors.

I know this tool Dust-Me selectors, but I want it to clean it automaticly.

Can anyone help me with this?

A: 

There's a windows based utility called CSS Cleaner available here. Obviously the issue is that it has to run through every pages in your project to determine which selectors aren't used. And it can't see into any CSS generated by your code.

Keltex
I only have two pages, I can load these seperatly with two different styles sheets, afterwards I can merge those two together. Thanks for the tip!
Chris
A: 

Here are some good tips not exactly as u want but helpful http://www.aggiorno.com/blogs/aggiornings/post/Detecting-unused-CSS-selectors-.aspx

This is also useful http://www.nealgrosskopf.com/tech/thread.php?pid=66

metal-gear-solid
+2  A: 

Depending on the complexity of your site, I don't think it's a good idea to clean up CSS automatically. I've used those tools myself (DustMe-Selectors mostly) but as soon as it comes to dynamic pages (and sites), all of the tools lack the ability to really find out what is used and what not.

Consider a site using selectors like "item-selected", "item-soldout", "item-bargain", etc. If the site will apply selectors dynamically to e.g. items in a shop, tools may not find those selectors in your markup because they are not used at the moment but maybe used as soon as the shop-configuration changes.

So I'd suggest to go with one (or more) of the tools suggested here and carefully evaluate the suggestions for unused selectors, but rather not use something to clean my code automatically.

Select0r
+1 very agree with ur point
metal-gear-solid
Good point indeed!
Chris