Book Image

Learning less.js

Book Image

Learning less.js

Overview of this book

Table of Contents (22 chapters)
Learning Less.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Importing style sheets into Less


Phew! We're almost there. We've certainly covered a lot in this chapter! Before we finish the chapter with some tips on avoiding code bloat, we should take a moment to consider one useful function that we've used, but not explored in any detail—this is the use of importing to manage our Less style sheets.

Importing in Less is a simple but useful trick to learn, particularly when managing large style sheets. We can begin to build up a library of code and then import it straight into any future project.

It makes it much easier to manage smaller files, as we can build a master file that imports each of the subfiles into one master; Less will only compile these styles that are directly referenced from our main code. So for example, if your code library file is more than 2,500 lines long, but a mixin of only 10 lines is all that is used, then Less will only include those 10 lines in the final compiled results.

Using the import option is really easy; all you need...