CSS init
the corz.org CSS "pre-processor"

Not static, baby!

When I first started doing CSS, I quickly realised that it was full of limitations and so generated it with php, working around browser bugs, switching color scheme values with replaceable %%tokens%%, sending values with includes, modularizing repetative code and so on.

Over the years the init has picked up a few capabilities, simple mathematical expressions, minification and more, and has become a fairly powerful CSS "pre-processor" (a term that didn't even exist when I first started doing this back in 2004!).

Okay, how?

The first thing you need to do is setup your web server to handle the .css files differently. I'll give examples for Apache, because that's what most people use; but similar things are doable in most web servers (and usually with the same code!).

Simply put, we tell the web server to not spit out the files as-is, but instead pipe them through php, so it can have its wicked way with them.

In your ".htaccess" file for your css folder, add this..

<FilesMatch "\.(css|style)$">
  SetHandler application/x-httpd-php

From now on, all files with a .css or .style extension, will be parsed by php, and treated as code.

Now for the code..

Init, innit?

Before we start spitting out individual CSS, there is some code which will be common to all the .css files. It makes sense to keep this in a single .php file, save having to code it into every one. We simply include it from the .css files.

css-init.php does the basic setup common to all the stylesheets, as well as quite a bit of magic, here it is..

Welcome to corz.org!

I'm always messing around with the back-end.. See a bug? Wait a minute and try again. Still see a bug? Mail Me!