Aaron Yodaiken
Aaron Yodaiken

Reputation: 19561

Optimizing css compiler

I'd like real optimization/compilation of my CSS styles (not just minification), in a similar vein as the Google Closure Compiler works for JavaScript.

For example, if my entire stylesheet is just:

div#hello { 
    color: #FFF;
    background-color: #000;
}

div#hello p {
    color: #FFF;
    margin-top: 10px;
    margin-bottom: 10px;
    margin-right: 10px;
    margin-left: 10px;
    font-family: Helvetica, Arial, sans-serif;
}

a {
    color: #FFF;
    margin-top: 10px;
    margin-bottom: 10px;
    margin-right: 10px;
    margin-left: 10px;
    font-family: Helvetica, Arial, sans-serif;
}

That can be optimized down into (I'm keeping whitespace here for readability, but obviously that would have to go too):

#hello {
    color: #FFF;
    background: #000
}

#hello p, a {
    color: #FFF;
    margin: 10px;
    font-family: Helvetica, Arial, sans-serif
}

Upvotes: 4

Views: 295

Answers (2)

John Rasch
John Rasch

Reputation: 63505

It looks like you want CSSTidy: http://csstidy.sourceforge.net/

Upvotes: 1

Joel
Joel

Reputation: 1140

This seems to be what you are looking for:

http://iceyboard.no-ip.org/projects/css_compressor

Heres a comparison of a few others:

http://www.bloggingpro.com/archives/2006/08/17/css-optimization/

Upvotes: 0

Related Questions