PDA

View Full Version : Ad-hoc preprocessor for CSS


phubuh
01-18-2003, 08:05 PM
hey duders. tonight, the combination of fatal boredom and irritation over the fact that there's no convenient fact to define your own colors in CSS, got me to produce the Ad-Hoc CSS Preprocessor (AHCSSP).

here's an example stylesheet that makes use of it:

1 /*! BACKGROUND = #cfc !*/
2 /*! FOREGROUND = #363 !*/
3 /*! LINK = #363 !*/
4 /*! FONT_FACE = sans-serif !*/
5
6 * {
7 } body {
8 background-color: /*! BACKGROUND !*/;
9 color: /*! FOREGROUND !*/;
10 } h1 {
11 font-family: /*! FONT_FACE !*/;
12 margin: 0;
13 } img {
14 border: none;
15 } a {
16 color: /*! LINK !*/;
17 font-family: /*! FONT_FACE !*/;
18 } hr {
19 height: 1px;
20 }
21

no, the numbers aren't really there, but i copied it from vim because i'm lazy. anyway, i think you can all figure out what this does, so without further ado, i uploaded the perl cgi program that fetches a CSS file, preprocesses it, and prints the result along with a "Content-Type: text/css" header. call it with the CSS URL as query string, e.g. <link rel="stylesheet" href="/cgi-bin/css.cgi?global.css" />. unless you use the standard debian apache setup with /var/www as webroot, you're going to have to change that in the code on row 20.

enjoy.