LESS is a dynamic stylesheet language designed by Alexis Sellier. It is influenced by Sass and has influenced the newer "SCSS" syntax of Sass, which adapted its CSS-like block formatting syntax.
LESS is open-source. Its first version was written in Ruby,
LESS provides the following mechanisms: variables, nesting, mixins, operators and functions.
Less allows variables to be defined. Less variables are defined with an at sign(@). Variable assignment is done with a colon (:).
During translation, the values of the variables are inserted into the output CSS document.
Mixins allow embedding all the properties of a class into another class by including the class name as one of its properties, thus behaving as a sort of constant or variable. They can also behave like functions, and take arguments. CSS does not support Mixins. Any repeated code must be repeated in each location. Mixins allow for more efficient and clean code repetitions, as well as easier alteration of code.
LESS has a special type of ruleset called parametric mixins which can be mixed in like classes, but accepts parameters.
CSS does support logical nesting, but the code blocks themselves are not nested. Less allows to nest selectors inside other selectors. This makes inheritance clear and style sheets shorter.
Functions and operations
Comparison to Sass
LESS is inspired by Sass. Sass was designed to both simplify and extend CSS, so things like curly braces were removed from the syntax. LESS was designed to be as close to CSS as possible, so the syntax is identical to existing CSS code. As a result, existing CSS can be used as valid LESS code.
The newer versions of Sass also introduced a CSS-like syntax called SCSS (Sassy CSS).
Use on sites
From Wikipedia, the free encyclopedia