In this chapter, one can learn about Less Import and how to import the Less files.
Description
Importing in LESS works similar to regular CSS importing. In general, people may split their style sheets into multiple files, instead of putting them in one place. So, they can import them with the command @import to another stylesheet whenever required.
Below are some of the benefits of using import.
Variables are shared across the imports.
Easy to collaborate with others.
The front-end development can have a modular and dry approach.
Example
Following is a simple example that explains the use of imports in LESS CSS.
Conceptual
figure
The below conceptual diagram represents the overall view like creating .html and .less files in node js folder and compile .less to .css
Step 1
Create HTML and LESS files as shown below. Make sure that both the files are created in the Nodejs folder.
Import.html
[c]
<html>
<head>
<title>Less Importing</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Less Css Importing benefits</h1>
<p class="myclass">Variables are shared across the imports.</p>
<p class="myclass1">Easy to collaborate with others.</p>
<p class="myclass2">The front-end development can have a modular and dry approach.</p>
</body>
</html>
[/c]