FAT

Why Less?

March 8th 2012

Since first open sourcing bootstrap one question Mark and I have heard a lot is: “why Less?” If you’re not familiar, Less is a dynamic stylesheet language meant to extend CSS with things like variables, mixins, operations and functions.

The question is a really good one and something we struggle with a lot ourselves. So much so, Mark asked me to write a little bit about some of the conversations we’ve had around our choice and why we’ve made it.

Going forward, I’m going to try to use this as a faq/wiki for common questions around our decision to use Less. Feel free to ask Mark or I more about any of these questions and I’ll update the post here. Thanks!

Why not Sass?

Sass is great. It ships with rails and has lots of cool, super powerful functionality. That said, we’ve chosen Less over Sass because:

  • Bootstrap compiles ~6x faster with Less than Sass A while back I created a simple benchmark which measured the time it took to compile Bootstrap (written in Less) vs. Bootstrap-Sass (the most popular boostrap port). Our Less version compiled in a little under 90 ms on average, while the Sass version compiled around 540ms.

  • Less is implemented in JavaScript We write javascript everyday, not Ruby. This makes it really easy for us to dive straight into the Less source and patch something if we encounter a bug or help to push a feature forward by doing the development work ourselves and sending a pull request. This has proven to be invaluable and just isn’t something possible for us in Sass.

  • Less is simple At the end of the day Mark and I want it to feel like we’re writing C