Posts from Wednesday, August 31st, 2005

The Constants Gardener

Published 18 years, 6 months past

This news is a little musty, but Shaun Inman updated CSS-SSC recently.  If you’re using CSS-SSC, you should definitely go grab the update.

“Hey, what’s CSS-SSC?” you exclaim?  Oh, I’m sorry.  It stands for Cascading Style Sheets Server-Side Constants.  Here’s Shaun’s initial example:

@server constants {
    linkColor: #AB6666;
    linkColorHover: #710101;
    }
a { color: linkColor; }
a:hover { color: linkColorHover; }

In other words, you can define your own constants in CSS.  This works because CSS-SSC is a preprocessor—it processes the style sheet before it’s sent to the browser, and turns it into something the browser can handle.  (Put another way, what arrives at the browser is a regular style sheet, with none of the ‘SSC’ information.)  Shaun offers more details in an earlier post.  CSS-SSC requires you to have PHP hanging about, and also to edit some stuff on your server, like .htaccess files.  You’ll also have to be careful about how you name your constants: use the constant name color, for example, and your CSS is going to go to a particularly mangled form of textual hell.

Personally, I’m both enthused and annoyed by CSS-SSC.  I think it’s a great solution: definitely one of the best, lightest-weight, easiest approaches to adding preprocessing to CSS.  I’m seriously considering putting it to use on ALA, in which I jumped through a few grouping hoops in order to get the fonts and colors just the way Jason wanted them.  Dropping back to constants would make life a bit easier—and would also simplify the whole “per-issue coloration” feature.  (Which I already have working, but via a large number of hoops, several of them on fire.)

I’m annoyed because it bothers me that Shaun had to create CSS-SSC in the first place.  There have been occasional requests for constants in CSS.  They get shot down every time.  “Use a preprocessor!” is the cry, and at first glance, CSS-SSC would seem to give credence to that response.  From my point of view, however, CSS should have had constants long ago, and what Shaun has done is proof.

The refusal to add constants as a feature of CSS has always stuck me as highly pointless.  Over the past decade, many people have expressed a need for CSS constants in a number of fora, and it’s a good bet many more have had the need without publicly expressing it.  Adding it to CSS would have done little to increase complexity on the implementor’s side; Shaun’s one-page PHP script (a good deal less when you remove the comments) proves that.  Adding it to CSS would have meant authors could just do it, without having to install anything else first.  Shaun’s made installation about as easy as it gets, but it’s still three or four steps more than should exist—and, for some authors, three or four impossible steps, due to their hosting situation.  And if you aren’t running a local web server, then you can’t test your CSS-SSC-enhanced styles locally; they’ll have to go to a web server first.

Because CSS still lacks, and will apparently continue to lack, a way to define your own constants, I’m really glad Shaun has devised this low-threshold solution.  I just wish that it hadn’t been necessary for him to do so in the first place.


The Softest Whimper

Published 18 years, 6 months past

This morning, I broadcast what might be the last radio show I ever host.

Almost nobody heard it, though, because yesterday evening the station’s 15,000 watt transmitter had a seizure and stopped sending out a signal– you know, transmitting.  So the station went off the air until 8am this morning, which happened to be the beginning of my show, the last in a nine-year run.

When we came back on the air, it was at 5 watts, which was all the transmitter was prepared to handle.  At that level, we were reaching an area of maybe ten square blocks.  At that level, the FCC technically has no province; only stations of 10 watts and above are regulated.  In theory, I could have played anything I wanted with no threat of legal reprecussions.  On the other hand, we were still webcasting, so I stuck to my format.

But instead of assembling a list of all my favorite tunes, I just put on two hours of Glenn Miller.  This wasn’t so much a case of “what’s the point?” as it was the fact that I couldn’t get into the station until ten minutes before my show.  Usually I’m there close to an hour beforehand to prepare.  And granted, I could have played an hour of Glenn Miller and an hour of favorites—but in the end, I didn’t have a good answer when I asked myself “what’s the point?”.

At the end of the show, as I’d planned, I delivered a short farewell to my audience, none of whom could actually hear me unless they happened to be within a few hundred feet of the transmitter.  I knew all my regular listeners, the ones to whom I’d hoped to say farewell, were beyond that range.

As I said “…and in the meantime, I’m out of here” for the last time and clicked off the microphone, the phone rang in the studio.  My God, had someone actually heard me and phoned in to say goodbye?

It was a fax machine.


Browse the Archive