Sass and LESS Preprocessors

Web developers should be familiar with one or both preprocessors

Coke or Pepsi, Mac or PC, Marvel or DC? In every community, there’s a debate over which is better. For web designers or developers, that debate is Sass or LESS.

Syntactically Awesome Stylesheets (Sass) and Leaner CSS (LESS) are both CSS preprocessors. They are special stylesheet extensions that make designing easier and more efficient. Both Sass and LESS compile into CSS stylesheets so that browsers can read them. This is a necessary step because modern browsers cannot read .sass or .less file types.

If you plan on being in the world of web development, it’s a good idea to be well-versed in one of the two preprocessors—if not both of themWhen it comes down to it, they have a lot of similarities. They make writing CSS simpler, more object-oriented, and more enjoyable. Nevertheless, there are a few key differences. 

01
of 05

Sass Is in Ruby While LESS Is in Javascript

Designers reviewing ideas on desktop computer
Shannon Fagan/Getty Images

Sass is based in Ruby and requires a Ruby install. This is no big deal if you have a Mac. However, it is a longer installation if you have a Windows machine.

LESS was constructed in Ruby, like Sass, but it has been ported to JavaScript. To use LESS, you must upload the applicable JavaScript files to your server or compile the CSS sheets through an offline compiler.

02
of 05

To Assign Variables, Sass Uses '$' While LESS Uses '@'

two male CSS programmers sitting in front of a laptop and desktop monitor in an office
  Luis Alvarez/Getty Images

Both Sass and LESS use specialized characters to assign variables. This is part of the benefit of using these preprocessors. You don’t have to keep entering specifications every time you want to assign variables. Instead, you can just enter the character.

In Sass, it’s the dollar sign ($). In LESS, it’s the "at" symbol (@). The only downside for LESS is that there are a few existing CSS selectors that already use @. That complication could stiffen the learning curve a bit.

03
of 05

Sass Has Compass While LESS Has Preboot

group of web programmers sitting with laptops, one laptop displaying lines of code
  Caiaimage/Gertty Images

Sass and LESS have extensions available to integrate mixins (the ability to store and share CSS declarations throughout a site).

Sass uses Compass for mixins, which includes every option available with updates for future support.

LESS has Preboot.less, LESS Mixins, LESS Elements, gs, and Frameless. LESS’s software support is more fragmented than Sass, resulting in a lot of different options for extensions that may not all function the same way. For your project, you may need to use multiple (or all) of the listed extensions to replicate the performance of Compass.

04
of 05

LESS Has Better Error Messages Than Sass

compter programmer looking through lines of code
  Razvan Chisu/Getty Images

Both Sass and LESS have been tested for their ability to report errors in syntax. LESS has more accurate error messages in the tests—it reported the correct location of the error. This can come in handy when a typo is derailing the code. LESS error messages can help you quickly identify the problem.

05
of 05

LESS Has More User-Friendly Documentation Than Sass

web programmer sitting in front of laptop in a coffee shop
  Hero Images/Getty Images 

The LESS documentation is visually appealing and easier to follow for first-time users. The Sass documentation requires either much more of base knowledge, or frequent cross-references with a wiki during setup.​​

This fact in and of itself could weigh heavily on the adoption rates of either Sass or LESS.