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
}
It looks like you want CSSTidy: http://csstidy.sourceforge.net/
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/
精彩评论