Is there a structured language for declaring styles in a sensible way, which can then be rendered into browser specific css files, similar to what GWT does to Javascript?
It would ideally be a language that supports variables, deals with browser quirks and differences (e.g. filter:alpha vs opacity), provides an intuitive syntax for common tasks such as centering, and has a way to express fallbacks for less capable browsers.
GWT’s ability to generate code on the fly and it’s powerful ‘deferred binding’ capability could definately be applied to stylesheets and allow for build-time optimization of CSS.
Right now, the ‘GWT way’, according to styles is to include all the styles you’ll need and use apply them by making use of ‘dependent style names’. But this definitely leads to lost of useless CSS being included where it’s not needed.
I know there is at least one attempt to optimize CSS at build time. This would involve combining multiple seperate stylesheets into one, and removing all non-essential whitespace (minifying). I think this might also allow you to make use of deffrred binding to essentially ‘optimize out’ CSS from where it’s not needed (ex: browser specific styles).
StyleInjector