View Full Version : CSS optimiser utility?

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:

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

.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)

.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.

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?

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}

.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.