Interview :: Less
The role of e() function is to escape a value from the Less compiler.
When recursive mixins are combined with Pattern matching and guard expressions, it can create various iterative/loop structures.
The easiest way to pre-compile a Less into CSS is to use Less.js with Node.js where Less.js run outside the browser.
The namespaces were used to group the Mixins under a common name. You can perform Encapsulation with the help of Namespaces and Accessors in the Less file.
For example:
The scope of variables refers to the place where the variables exist. The variables were searched in the local scope first. If it is not in the local scope, then the compiler search in the parent scope.
For example:
In the above Less document variable a is defined inside the class with value 20 and variable with the same name is also defined outside the class with value 15. When the compiler executes this Less document, it searches for the local scope first. Hence the local scope of the variable is used. After the compilation process, CSS file is created having font-size value 20px.
The commenting refers to some text which is understandable by the humans to understand the working of some complex codes in the programming.
The reaction of the compiler to the comments is nothing. The compiler ignores the comments at the time of compilation of the code.
Two types of comments are allowed in the Less document, inline comments and block comments. However, if you write inline comments in your code, the compiler ignores it and not adds that code to the CSS file. Only block comments will be added to the CSS file.
The importing is used to import CSS or Less document into the Less document. Importing can be done by including "@import" followed by the address of the CSS or Less file at the beginning of the Less document.
The extend is a Less pseudo class which is used to select another selector style in one selector.
For example:
In the above example of extending style class properties have been imported into the properties of h2.