1) Explain what is LESS?
LESS is dynamic style sheet producing language. LESS is a CSS pre-processors and extends CSS with dynamic behaviour. It allows for variables, mixins, operations and functions. LESS runs on server side and client side both.
2) Explain how to create LESS file and where to store it and compile it?
Creating or storing LESS file is similar to creating/storing CSS file. A new LESS file can be created with a .less extension, or you can rename existing .css file to .less file. You can write LESS code with existing CSS code.
The best way of creating it inside ~/content/ or ~/Styles/ folder
3) In what ways LESS can be used?
- Via npm LESS can be used on the command line
- Download as a script file for the browser
- For third party tools, it is used
4) How variable is represented in LESS?
LESS allows variables to be defined. In LESS, the variable is represented as @sing. While, variable assignment is done with a: (colon) sing. The values of the variables are inserted into the CSS output file as well as minified file.
5) Explain how Mixins is useful?
Mixins enable embedding all the properties of a class into another class by including the class name as one of its properties. It is just like variables but for whole classes.
6) Explain how can set code in a watch mode when you run LESS.js in an HTML5 browser?
If you run LESS.js in an HTML5 browser, it will use local storage to cache the generated CSS. However, from the developer point of view they cannot see the changes they made instantly. In order to see your changes instantly, you can load program in development and watch mode by following JavaScript
<script type= “text/javascript”>
less.env = “development “ ;
less.watch () ;
</script>
7) Explain what is the meaning of nesting in LESS programming?
Nesting in LESS is clustering of statements inside other statements, so it forms a group of related code. In other words when we add a code snippet and add another code inside it, then that code snippet is called nesting.
8) Mention what are the color channel functions used in LESS?
- hue
- saturation
- hsvhue
- saturation
- hswalue
- red
- green
- blue
- alpha
- luma
- luminance
9) Explain what is data-uri in LESS?
In CSS, Data URI’s is one of the best technique, it allows developers to avoid external image referencing and instead embed them directly into a stylesheet. Data URIs are the excellent way to reduce HTTP requests
10) Explain what “Source Map Less Inline”?
The “ Source Map Less Inline” option indicates that we should include all of the CSS files into the sourcemap. Which means that you only need your map file to get to your original source.
11) Explain what is the use of Extend “all” in LESS?
When you specify all keyword last in an extend argument, it tells LESS to match that selector as part of another selector.
12) Explain what is “StrictImports” in LESS?
The strictImports controls whether the compiler will allow a @import inside of either @media blocks or other selector blocks
13) List out the differences between LESS and Sass?
Each style-sheet language is good in their perspective and use; however there are few differences in their usage.
LESS | Sass |
– LESS uses JavaScript and processed at client-side | – Sass is coded in Ruby and thus processed to server-side |
– Variable names are prefaced with the @symbol | – Variable name are prefaced with $ symbol |
– LESS does not inherit multiple selectors with one set of properties | – Sass inherits multiple selectors with one set of properties |
– LESS does not work with “unknown” units neither it returns syntax error notification for incompatible units or maths related syntax error | – Sass allows you to work with “unknown” units also returns a syntax error notification for incompatible units |
14) What are the similarities between LESS and Sass?
Between LESS and Sass the similarities are
- Namespaces
- Color functions
- Mixins and parametric mixins
- Nesting capabilities
- JavaScript evaluations
15) Explain what is the use of &combinator ?
&combinator concatenates nested selector with the parent selector. It is useful for Pseudo classes such as :hover and :focus
16) Explain what is the use of operations in LESS?
Operations can be used for performing functions like
- Simple Mathematical operators: +, – , *, /
- Color functions
- Math functions
- Any size or colour variable can be operated upon
17) Explain what is the use of Escaping?
The use of escaping in LESS
- When you need to output CSS that is not valid CSS syntax
- Proprietary syntax not recognized by LESS
- LESS compiler will throw an error if not used
- Simple prefix with ~ symbol and put in quotes
18) What does LESS elements contains?
Less elements contain commonly used mixins like
- .gradient
- .rounded
- .opacity
- .box-shadow
- .inner-shadow
19) List out alternatives against LESS?
- SASS: Syntactically Awesome Stylesheets
- SCSS: Version.2 of SASS
- Stylus
20) Explain how you can invoke the compiler from the command line?
You can invoke the compiler from the command line in LESS as
$ lessc styles.less
This will output the compiled CSS to stdout; you may then redirect it to a file of your choice
$ lessc styles.less > styles.css
21) What is the use of e () function?
With the help of e() function you can escape a value so that it passes straight through to the compiled CSS, without being noticed by the LESS compiler.
22) Explain how you can pre-compile LESS into CSS?
To pre-compile LESS into CSS you can use
- Run less.js using Node.js : By using the Node.js JavaScript framework you can run the less.js script outside the browser
- Use lessphp: For the implementation of the LESS compiler written in PHP, lessphp is used
- Use online Compiler: Use online compiler for quick compilation of LESS code without installing a compiler
- Less. app (for Mac users): Less.app is a free tool for Mac users, this tool auto compiles them into CSS files
23) Explain how merge function is used in LESS?
For aggregating values from multiple properties into a space or comma separated list under a single property LESS is used. It is useful for properties such as transform and background
24) How can you create a loop structures in LESS?
A mixin can call itself in LESS. Such recursive mixins, when combined with Pattern matching and Guard Expressions, can be used to create various iterative/loop structures.
25) Why do we need parametric mixins in LESS?
Parametric mixins are same like standard mixins. The only difference is that parametric mixins take parameters like functions in JavaScript. After determining parameters to the mixins, you get more control over mixins.
No comments:
Post a Comment