Tidy up that CSS
- Started
- Last post
- 14 Responses
- doctor
Does anyone know of a tool that is able to tidy up a stylesheet, based on which elements, IDs and classes etc. that is used in a specific HTML document?
I'm working on a collaborative project and the CSS has grown beyond control. A lot of the CSS doesn't apply to the HTML anymore, but it would be hell to check it all manually.
Any tips?
- Mojo0
I second this request
- doctor0
I've searched for it, of course, but I can't find anything that does the trick. A lot of CSS compresser tools and the like, but nothing that can check for obsolete styles, based on a HTML document.
Maybe I should just code such a program myself, but it ought to exist already, I figure...
- doctor0
Flavourful: No, you are surely not. But it doesn't take much indolence from just one of the developers, before there's outdated code in the stylesheet, when the mark-up is still being worked on. :-)
- haha yes, that was what I didn't read. * Gets back in Hummer w/ a Prius Shell. *flavorful
- It gets even worse gas mileage than a Hummer and the backseat is big you can perform...flavorful
- an abortion in it! Which is great if you perform as many abortions as I do.flavorful
- Which is a lot...flavorful
- Because I love them!!!flavorful
- Man all this talk about abortions has gotten me super wet!flavorful
- geralddean0
its called find and replace...
search for class="blablabla" where blablabla is the name of the style in the css file. And you can search across an entire site using DW.
- al_la0
you might want to check this out.
http://www.gosquared.com/liquidi…I remender I asked for a toll likre that to a programmer where I used to work 2-3 years ago. I remember he did it.
- ismith0
Buy a 5th grader.
- ldww0
In a world of dynamic pages assembled from mulitple templates and other elements, I would be afraid of a tool that detects unused css. What happens when you do an ajax request and it ads something w/ a class which wasn't there before.
- Yes that would be a problem. I would simply add all AJAX shizzle after deploying this kind of tool, I'm asking for.doctor
- doctor0
The Dust-Me Selectors add-on for Firefox works like a charm (http://www.sitepoint.com/dustme... I find the Spider function especially usefull.
Thanks Jamble, you iz the man of the day!
- mg330
Great link doctor.
- yaphi0
Next time comment your CSS and break it into sections =) I also write all my rules alphabetically for each class. Dunno of a way to check what is being used vs not used. I guess I would manually search for class names through my templates.