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

Commenting your code in Less


Commenting your code will help you and others to better understand the code. If you or someone else have to change your code, maybe after a long period since the code was written, the comments should clarify what a block of code does and why it was added in the first place.

Getting ready

In this recipe, you will need a randomly chosen Less file without a comment. If you don't have such a file, you can create one yourself.

How to do it…

  1. Open your Less file.

  2. Then, start adding comments.

    Both Less and CSS allow you to use block-level comments that start with /* and end with */. The following code will show you an example of a block-level comment:

    /*
    * Example code for Less Cookbook
    * copyright 2014 by Bass Jobsen
    */

    In contrast to CSS, Less allows single-line comments. A single-line comment starts with //, as shown in the following example code:

    @menuColor: red; //sets the background color for the menu

Note

Note that you cannot nest two or more block-level comments. Nesting...