...

View Full Version : CSS optimiser utility?



mannix1959
08-25-2010, 02:33 PM
Let's say I have 2 stylesheets (sheet1.css & sheet2.css), used on different pages, that contain the following:

sheet1.css
.pop_bg{background:#fff;border:1px solid #000;}

sheet2.css
.div_bg{background:#fff;border:1px solid #000;}

Now, with copy&paste, I put these 2 sheets together in 1 sheet for all my pages (sheets_all.css)

sheets_all.css
.pop_bg{background:#fff;border:1px solid #000;}
.div_bg{background:#fff;border:1px solid #000;}

Does anyone know of a utility or an online service that can check sheets_all.css and say "Hey, classes pop_bg and div_bg are identical! Better remove one to reduce file size!"

I have found several css optimiser services through google, but none of them checks for duplicate classes.

teedoff
08-25-2010, 06:01 PM
Not sure if there is one. Did you try w3c css validator to see if there might be any errors?

mannix1959
08-26-2010, 06:22 PM
Yes, I did. No errors in the code.

http://www.cssoptimiser.com/ will turn


.pop_bg{background:#fff;border:1px solid #000}
.div_bg{background:#fff;border:1px solid #000}
into

.pop_bg,.div_bg{background:#fff;border:1px solid #000}

but it doesn't detect that div_bg and pop_bg are in fact copies of eachother.
It looks like there is no such utility available anywhere. I could write one myself, in php, if I wasn't facing a deadline. So, maybe in a next project.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum