Preprocessing

It’s easy to see the charm of preprocessors like LESS and Sass. What’s typical and unfortunate is the dogma many developers get caught up in. Is one better than the other? Maybe, but the problem preprocessors bring has nothing to with syntax or robustness. It’s what they hide from you.

The more it hides the more you’re specialising in the tool itself. Variables and mixins are useful and relatively innocuous because they don’t hide that much code from you. They’re just DRY. Using funky third party mixins for backgrounds can become a little ridiculous and end up being dependant on their continuous support. Nesting is another one where things get sticky. I can see the appeal of nesting but they move away from what makes CSS so powerful. CSS is all about the cascade and nesting is about isolating.

.classname { 
    ... 
    }
.classname a { ... }

Or

.classname {
    ...
    a { ... }
    }

One isn’t worse than the other, so how on earth is nesting better? Never mind the risk of nesting parsing out more code, especially on more complex nesting. Complex nesting can also make it more difficult to read the selectors. When you have to review large stylesheets it’s easier to miss something. On other hand Sass foregoes braces which makes the rules very easy to read. I can imagine that some warm to the idea that nesting can look like coding, however, CSS is not coding.

This is in essence the main divide between Sass and LESS. Sass was developed by developers for developers. LESS seems to have avoided that feel, that complexity of a coding tool. In the end there is little point in comparing the two because dogma is always going to get in the way.

Recently Coda 2 was released and it suffers from mixed reviews by widely varying types of end users. But everybody agrees that the software is of high quality, at a level we should aspire to.

Preprocessing is similar in that we may nitpick about the tools but those who have tried variables in CSS will never look back. Preprocessing is here to stay.

Next entry: Forward motion
Previous entry: Get off my grid!