Less is different from sass

1. Different compilation environments

  • Less is JavaScript based and is handled on the client side.
  • Sass is Ruby based and is handled on the server side.

2. Variable characters are different

  • The only difference between Less and Sass variables is that Less uses @ and Sass uses $

3. Output Settings

  • Less has no output setting. Sass provides four output options: nested, compact, compressed, and expanded

For example:.scss

nav { ul { margin: 0; padding: 0; list-style: none; } li { display: inline-block; } a { display: block; padding: 6px 12px; text-decoration: none; }}Copy the code
1>nested () :
nav ul {  
  margin: 0;  
  padding: 0;  
  list-style: none; }  
nav li {  
  display: inline-block; }  
nav a {  
  display: block;  
  padding: 6px 12px;  
  text-decoration: none; } 
Copy the code
2>expanded(expanded output) :
nav ul {  
  margin: 0;  
  padding: 0;  
  list-style: none;  
}  
nav li {  
  display: inline-block;  
}  
nav a {  
  display: block;  
  padding: 6px 12px;  
  text-decoration: none;  
} 

Copy the code
3> Compact output:
nav ul { margin: 0; padding: 0; list-style: none; }  
nav li { display: inline-block; }  
nav a { display: block; padding: 6px 12px; text-decoration: none; }  
Copy the code
4>compressed output:
nav ul{margin:0; padding:0; list-style:none}nav li{display:inline-block}nav a{display:block; padding:6px 12px; text-decoration:none}Copy the code

4. Different conditional statements

  • Sass supports conditional statements. You can use if{}else{},for{} loops, and so on. Less does not

5.Sass and Less have different libraries

  • In short, the relationship between Sass and Compass is similar to that between Javascript and jQuery. Compass encapsulates a series of useful modules and templates that complement and enhance Sass’s functionality.
  • Less has UI component library Bootstrap. Bootstrap is a well-known front-end UI component library in Web front-end development. Part of the source code of Bootstrap style files is written using Less syntax.