About two years ago, I tweeted “If your CSS is complicated enough to need a compiler or pre-processor, you’re fucking doing it wrong!” I meant it too. After-all, CSS isn’t hard to learn and it’s easy to write and write quickly. So why would you need a processor like LESS or Sass?
People reacted (as they do) telling me I was wrong. I wasn’t oblivious to their enthusiasm, so I pulled up the Sass website, ready to dive in. Wait.
First of all, let’s get Sass up and running. If you’re using OS X, you’ll already have Ruby installed. Windows users can install Ruby via the Windows installer, and Linux users can install it via their package manager. Once you have Ruby installed, you can install Sass by running
gem install sass.
Sorry, what? Now you can berate me for not understanding the Terminal if you like, but I’ll trade your ruby gems for my under-colour removal and dot gain, any day of the week. How hard should this be? Really?
sass --watch style.scss:style.css
sass --watch stylesheets/sass:stylesheets/compiled
That hard. Obviously.
If you were watching Twitter that night, it wasn’t just the interface that was blue. Chris Eppstein was watching. He kindly offered to help, so I turned my Mac over to him and I watched as he remotely flew through Terminal commands and listened while he tried to explain why I couldn’t see anything that he was installing where I expected it to be — in my Applications folder. Boy did this seem like a lot of work. I just didn’t get it.
Why the frak do I need control directives in CSS? If I’m using a @for loop to generate styles I’m doing something very wrong. CSS is not a programming language, it’s a style language and the preprocessor community should keep that in mind.
There are a few reasons for this:
Most CSS gurus aren’t programmers. When they start seeing logic, variables, mixins, and other programming constructs in their style sheet, they freak out a bit.
CSS gurus are just that: CSS gurus. They already know how to write their way out of any paper bag you can find using CSS. They’re experts. They don’t need a preprocessor. Developers are writing these things because, for them, CSS is confusing and missing useful functionality. But CSS gurus don’t look at CSS that way. Most CSS gurus think CSS is, by and large, pretty darn great. Sure, we have little nits to pick, but for the most part, CSS works for us, and we know how to bend it to our will.
To the typical CSS designer, the command line is a frightening place.
Even a simple CSS guru knows that code generation reeks of inelegance (not saying Sass is inelegant or that there aren’t good examples of code generation … just that, as a concept, it scares people).
Fast forward to this summer. I’m now primarily working with clients in week long agile design/development sprints, so I need to be faster and have more flexibility when I’m writing CSS. With clients’ budgets squeezed, I also want to spend more time being creative and less reinventing code.
When Twitter released their Bootstrap it came with set of LESS files, which prompted me to take at LESS. A few days working with it and I was converted. These days I’d be loathed to work without it.