Smashing Magazine raises a good point...

Status
Not open for further replies.

bam bam

New member
Oct 9, 2007
962
11
0
7 Principles Of Clean And Optimized CSS Code | CSS | Smashing Magazine

There is one last type of application that can help prune CSS file size I’d like to mention. It can crawl a web site and log which CSS rules and declarations are not being applied, then bring these to your attention. Unfortunately, this tool hasn’t been invented yet, but I would gladly pay for such a application.


I can recall times when I’ve been afraid to delete certain rules because there is no documentation that explains to me that those selectors are leftover from previous iterations of development. If an app can bring those rules to my attention, that will help with maintenance and keeping CSS files lean.

Why doesn't such a thing exist yet?

Surely it can't be too hard to write a script that crawls your entire site's source looking for instances of class="something" & id="something" then takes the results and checks the style sheet for #something or .something respectively.

This would be top of my list of things to create if I had the know-how.
 


I've often thought about how useful a tool like that would be, as I'm really bad at keeping my css inline with my code.

It's having the time to actually do something about it though!
 
This should not be that hard to write. But, in the times of broadband, does CSS file size really still matter? I mean, whats the big difference between for example 3KB and 4.5KB css file? Bandwidth on high traffic sites? Even at 100.000 uniques a day, the difference would be only 150MB if I calculate correctly.
 
You know what, I found an old script which makes something similar. I'll do something with it, maybe it will do the job.
 
Huh, third post in a row, sorry bout that.
I made a quick script for that, you can check it out at CSS check
its just a dirty script so it probably does not recognize all css inclusion methods etc., so there is definitely room for improvement
 
Status
Not open for further replies.