CSS Server Side Pre-processor

While I was going through links on smashing magazine and I come across the following link:

Its using php to call in constants and variables to place throughout the whole of the CSS document.

@server variables
$variableName1: defaultVariableValue;
$variableName2: defaultVariableValue;
$variableName3: defaultVariableValue;
body { background-color: $variableName; }
will output:
body { background-color: defaultVariableValue; }

Would be interesting to find if this method would work using ASP or .NET, anyone up for a challenge?
Going through the article,comments and links on the site I noticed that the css was also in nested declarations.
I really like the idea of using nested declarations, does this actually work? (note to self: test and play with this!)

div {
/* comment for div */
color: green;
p {
/* comment for div p */
color: red;
b { color: blue;

Source: http://blog.airbladesoftware.com/2006/12/11/cssdryer-dry-up-your-css

Will have to put this to the test to see if its all compliant etc.
I’ve had a quick look on the web for asp versions of the php variable css sheet and returned the following:


Not too happy about the title though! “Screw standards – let’s add variable support to CSS right this minute”.
I think this is one for the techies to continue!

Edited: Adding resource link http://nubyonrails.com/articles/dynamic-css

Categories: CSS


0 Leave a comment