Hey all,
Shaun Inman recently published a new tool that I though deserved
to get some attention, especially since it's directly about CSS and
fills what I consider to be a hole in CSS.
It's called "CSS-SSC", where the "SSC" parts stands for
"Server-Side Constants". It lets you define constants in your style
sheet like so:
@server constants {
baseColor: #ABCDEF;
hiliteColor: #0DECAF;
baseFont: Helvetica, Arial, Verdana, sans-serif;
}
body {font: small baseFont;}
a:link {color: baseColor;}
a:hover {color: hiliteColor;}
Okay, those are very limited examples, but if you picture using
constants in a large style sheet, you begin to see why they could be
very handy.
It does require that you have PHP running, and that you edit a
.htaccess file in order for this to work. It also requires that your
CSS files get poured through PHP in order to be preprocessed. The
end result is that they'll be sent out as regular CSS, with all the
constants substituted. It has to happen this way, because otherwise
browsers would get confused (rightly so).
And while it's possible to cover many cases with grouped
selectors, I speak from personal experience when I say you can end up
jumping through some pretty crazy hoops with just grouping. There
are definitely cases where I'll be using CSS-SSC to make my CSS less
obfuscated.
The forerunner to CSS-SSC, which was called CSS-SSV, came up in a
thread about PHP echoes in CSS, and I was concerned it had gotten
buried. Hopefully this will come to the attention of anyone who
needs it.
--
Eric A. Meyer ([EMAIL PROTECTED])
Principal, Complex Spiral Consulting http://complexspiral.com/
"CSS: The Definitive Guide," "CSS2.0 Programmer's Reference,"
"Eric Meyer on CSS," and more http://meyerweb.com/eric/books/
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/