Less is More

Among other things, I’m the main HTML/CSS guy on Tucows.com and butterscotch.com. As such, I’ve run into many situations where I found the only way to get the effect I was looking for, was to copy a chunk of CSS code from the same document; whether it’s as simple as a colour code, or as involved as a whole set of CSS properties. As a programmer, that’s a heartbreaking position to be in. (Don’t get me started on HTML emails.)

Time and again, I’d hoped each successive iteration of the CSS specification would introduce variables and other such syntactic goodies. But alas, there was no joy.

No joy, that is, until a couple of brave souls decided to take matters into their own hands. You can do that with open source, you know. Alexis Sellier and Dmitry Fadeyev have put together a CSS pre-processor, called Less. It adds four new features to CSS:

  1. Variables
  2. Mixins
  3. Nested Rules
  4. Operations

You can find out all about it at their comprehensive documentation page.

The pre-processor is written in Ruby, and installed without a hitch on Bender2, with just one command in Terminal. I’ll let you know how much of a horror-show installing it on Windows will be when I get to it at work.

I’m really looking forward to using this. Let me know of your experiences.

Update: I just installed less on my Windows XP box at work. Minimum drama.

I also downloaded the less package, but I’m guessing that wasn’t really necessary. gem probably downloads it on it’s own.

Update 2008-08-17: Ran into errors with the Ruby version. But found a link to a PHP version in the Less discussion group.

Shaun Inman has also produced CSS Cacheer. Please let me know what you think of these if you try any of them.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.