You will know already that the @import
directive in CSS can be used to import other CSS files into your CSS code. In Less, you can use the @import
directive to import the Less code from other files. The @import
directive enables you to spread your Less code over more than one file, which gives you the opportunity to build a logical and easy-to-maintain structure of Less files.
In this recipe, you will create a main project file that will import your other project files. You need to create the following files and directories:
You can edit the Less files with your favorite text editor and use the command-line lessc compiler, as described in the Installing the lessc compiler with npm recipe in Chapter 1, Getting to Grips with the Basics of Less, to compile the project.less
file.