Over the past couple of years, I’ve become a huge fan of Sass. It’s really the only way I write CSS now, and frankly, if anyone tried to make me write plain ol’ CSS I’d probably knee them straight in the taint.
But CSS preprocessors like Sass and LESS aren’t for everyone. At least not yet. There’s still a lot of resistance to them from the community. In fact, I resisted them for a long time, myself (here’s an old post from Nathan Borror’s blog where I outwardly hated on Sass). When you’re very comfortable with something, like many of us are with CSS, it’s hard to switch to doing it a different way.
Folks who are used to writing a lot of CSS seem discomforted by the idea of writing in one language and having it output another. I used to have to exact same discomfort, so I know how they feel.
Years ago, we wrote static HTML. Now, we almost never do. Our HTML is virtually always pre-processed, be it by PHP, Python, Ruby, Perl, .NET, Java, or something else. Today, we almost never write and serve straight HTML. Instead, for example, we write PHP that outputs HTML.
Amber Weinberg, a talented front-end developer in London, wrote a piece today about her explorations into Sass and LESS, and (among many other insightful things), had this to say:
What happens if another developer needs to edit the CSS and doesn’t know or realize a preprocessor is being used? How do you sync the two?
It’s a fair point. Once you move to writing your CSS with a preprocessor, you pretty much have to move to a workflow where everyone on the team edits the pre-processed file, rather than editing the plain ol’ CSS that’s generated during processing.
But isn’t that true of HTML, too? Couldn’t you rebut Amber’s question by asking: “What happens if another developer needs to edit the HTML and doesn’t realize you’re using PHP?” The answer, of course, is just the same: that developer needs to edit the PHP code, not the HTML it outputs. But no one seems to mind that. No one calls it a knock against PHP.
It’ll take some time for folks to get comfortable with it, but my feeling is that virtually all CSS is going to be written this way in the relatively near future, just like virtually all HTML is now pre-processed through PHP, Python, Ruby, or whatever.
What do you think? What’s been your experience with CSS preprocessors?