Book Image

LESS WEB DEVELOPMENT COOKBOOK

Book Image

LESS WEB DEVELOPMENT COOKBOOK

Overview of this book

Table of Contents (19 chapters)
Less Web Development Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Importing and organizing your Less files


When starting a new project, it is important to think about how to organize your code. The best thing about Less is it provides the ability to reuse your code and deploy the DRY 'principle. Your file structure should also be optimized to take full advantage of these benefits.

Getting ready

In this recipe, you will set up a flexible file and directory structure that will enable you to easily extend and reuse your code.

Before setting up your own project, you can study the file structure of some other projects. You can look at the Less files of the following projects:'

How to do it...

  1. First, create the file in your directory structure, as shown in the following figure:

  2. The project.less file includes all the Less code, including your custom code in main.less, as follows:

    @import "variables.less";
    @import "mixins.less";
    @import "reset...