Importing LESS files
You can split your LESS code into multiple files and then assemble them into a single CSS file. This is done with the @import
command.
Let's look at an example. Let's say we have a file lib.less
, where we will place helper functions:
.mix() {
color: red;
}
Let's import this file to our main styles.less
file:
@import url('lib.less');
After importing, all data from the imported file becomes available in our file. Therefore, we can use the mix .mix
:
div {
.mix;
}
Make a file with a library of useful functions. Import it to your main file.