Discussion on the difference between sass and less

Source: Internet
Author: User

Sass and less are an extension of CSS, which itself cannot replace CSS, but it can help us simplify the code and do more with fewer code.

Less and sass have some grammatical commonalities, such as the following:

  • Mix the class in the (Mixins)--class;
  • Parameters are mixed--the class that can pass the parameter, just like a function;
  • Nested rules are nested in the--class class, thus reducing duplication of code;
  • Mathematics is used in the arithmetic--css;
  • Color function--can edit color;
  • Namespaces (namespace)--grouping styles, which can be called;
  • Scope-local modification style;
  • JavaScript assignment-use JavaScript expressions to assign values in CSS.

(1) One of the major differences between sass and less is that less is JavaScript-based and is processed on the client side, while Sass is based on Ruby and is processed on the server. Many developers don't choose less because the JavaScript engine takes extra time to process the code and then output the modified CSS to the browser.

(2) Sass and less are also significantly different in variable scope. Less has global variables, and sass temporarily does not have the concept of global variables.

(3) The point that sass is more perfect than less is that sass can edit functions by @function, loop the data through @for loops or @each loops, and judge the data by @if else.

Discussion on the difference between sass and less

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.