Sass and Less

Posted June 17, 2009

There’s been a lot of buzz recently about the release of Less, a new CSS preprocessor created by Alexis Sellier. It takes a lot of inspiration from Sass: it supports variables, arithmetic, nesting, and mixins, although none to the full degree of power that Sass allows.

There are two things that Less offers that Sass doesn’t: implicit mixins and a syntax that’s closer to CSS. Implicit mixins just mean that every class defined in a Less file can be used as a mixin. This means that when designers discover that they want to re-use a class, they can skip the step of refactoring it into a mixin.

The syntax is what’s really getting people excited, though. Unlike Sass, which has its own nested syntax, Less builds on existing CSS syntax, using brackets and semicolons rather than indentation and newlines. The variables are more familiar for Ruby developers, too, being prefixed with @, rather than !.

The haml-edge Gem

Posted May 26, 2009

I’ve been working hard on getting Haml 2.2 ready for release. Not only are there copious syntactic improvements in Haml and especially Sass, but we’re hoping to switch from RDoc to the excellent YARD. This is a lot of work, though, so the release is taking quite a while.

Meanwhile, Chris Eppstein (on the Sass core team) has been working on Compass, an awesome CSS framework that makes full use of the power of Sass, including the new features that’ll be released in 2.2. This means that it requires the unreleased master branch, which used to be quite a pain to install, let alone to list as a dependency.

I haven’t been using GitHub’s gem-building facility for Haml, since it doesn’t allow filesystem access, which Haml requires to build gems properly. But I’d like to release development gems to make it easier to use Compass until 2.2 is released. So I’ve set up a little Sinatra server to take post-receive hook on GitHub and generate and release a new gem: haml-edge. The version number for this gem is bumped and a new gem released every time I push to master, so now Compass (and anything else that relies on unreleased features) has a gem it can list as a dependency within the standard gem structure.

More Haml Benchmark Issues

Posted April 7, 2009

This morning I got a bit of an unpleasant surprise in my feed reader. had pointed out an interesting line in the longstanding ERB file that we use as a baseline against which to test Haml’s performance. The two files are supposed to be as similar as the difference in language permits, but Magnus pointed out a serious discrepancy.

The relevant line in the ERB file was <%= line %>, but the one in the Haml file was - line. That is, the ERB variable was being concatenated to the document, but the Haml variable was not. Which means the ERB benchmark was doing a lot more work than the Haml benchmark.

The upshot of all this is that all previous benchmark results are invalidated; in particular, Haml is significantly slower than I had thought and indicated. The previous benchmarks indicated that Haml was slightly faster than ERB for similar documents. Now according to my benchmarks Haml 2.0 is 3.24 times slower than ERB, or 2.42 times slower with the :ugly option enabled.

Ada Lovelace Day: Gayle Laakmann

Posted March 24, 2009

Today, I just learned, is Ada Lovelace Day. The idea is that people write blog posts about women in technology that they admire, so I thought I’d join in.

I’ve talked about Gayle Laakmann tangentially in past posts, but this one is going to focus solely on her. Three years ago almost to the day, I signed up for Computer Science and Engineering 490. 490 is a “special topics” class; it’s the number the CSE department assigns to any class that’s offered temporarily and doesn’t fit anywhere else. The one I was taking was Software Design and Development,worked for Google. taught by Gayle Laakmann.

Gayle had recently joined Google after working at Microsoft. All the students were in awe; we had all just come through the intro CS sequence, so we knew how to program, but writing actual software that actual people would want to use seemed impossibly far-off. Gayle was someone who did that every day, and what’s more she was going to put us on the path to writing that sort of software ourselves.

Highlighting Ruby in haml-mode

Posted March 6, 2009

Along with Haml, I maintain the Haml language mode for Emacs. It’s reasonably featureful, including support for managing indentation, cutting and pasting nested regions (although by default there are no keybindings for this), and some syntax highlighting.

One thing it’s sadly lacked, though (until now!), has been support for highlighting embedded Ruby code in a reasonable manner. Emacs’ syntax-highlighting system, known as font-lock, is quite powerful and flexible, allowing all sorts of constructions to be highlighted using a reasonably straightforward, declarative syntax. On top of that, it ensures that even very large documents are highlighted as well as possible without parsing the entire thing.

Unfortunately, for all its flexibility, font-lock doesn’t include any mechanism for highlighting a subsection of the document based on different rules than the rest of the document. So what I had going for a long time was a cop-out: I had a few random Ruby items (instance variables, strings, etc.) manually coded into the Haml font-lock specification, and the rest of it just went unhighlighted.

MuMaMo

Sass, Haml
Tags

Chris Eppstein Joins Sass Team

Posted December 29, 2008

It’s been too long since I’ve made a post here. I’ve actually had lots of ideas floating around in my head, but they all seemed too small to make a good first-post-in-a-while. I’ve decided that doesn’t matter, so I’m just going to start writing small posts as ideas hit me.

The first one, this one, is an announcement that I’ve been meaning to make. This shouldn’t come as much of a surprise to anyone paying attention to the Haml lists: Chris Eppstein is now a member of the Sass core team.

Chris has been doing a lot of really cool stuff with Sass recently. He’s the author of the Compass framework, the first Sass framework (as far as I know) which contains ports of the Blueprint and YUI CSS libraries as well as its own core code, all Sassified to make it more modular, semantic, and powerful than the source frameworks. He’s been pushing the boundaries of Sass as a language and in the process helping to form what will become Sass 2.2 (more on that in a future post).