views:

42

answers:

3

Does anyone know of software or a webservice that can read your stylesheet and html/php, and profile your CSS? By that I mean indicating which clauses or rules are never used, and so on.

After doing several serious redesigns on a fairly complex website, I'm sure there are some old skeletons hiding away, making my code clunkier and less readable, doing absolutely nothing, setting rules for divs and spans long since removed.

+2  A: 

Try using firebug, the firefox extension. It will tell you what rules aren't being used and which ones are unnecessary.

Capt Otis
+1: Firebug is too good. it strikes out styles which are overridden or not required.
Ankit Jain
Firebug will only highlight inheritance, but I believe the OP not only wants that, but also rulesets that are never used at all, which Firebug can't do
Yi Jiang
I use firebug a lot, but I really need something that'll go through these massive stylesheets, compare them to the html, and say "cut out these blocks, they don't do anything" and so on
Mala
i didn't know firebug could do this!
Patricia
+1  A: 

Well, I've found something interesting. Using the "Audits" tool as part of the Chrome developer tools, you can find out which CSS rulesets are extraneous.

alt text

It's quite basic - it doesn't even point to the line number each of these rules are located from, but it is better than nothing. Hope this helps.

Yi Jiang
+2  A: 

The 'Dust-Me Selectors' Firefox plugin is quite helpful for finding unused rules, it can test individual pages and spider entire sites.

Richard M
Thanks! This is more or less what I was looking for
Mala