Comments
Comments make your code clear and readable for others. It is important that you are able to understand them clearly. That is why this chapter starts with some notes and examples of comments.
Tip
Don't be sparse with your comments when keeping the file size, download time, and performance in mind. In the process of compiling and minimizing your final CSS code, comments and other layout structures will be effectively removed. You can add comments for understanding and readability wherever needed.
In Less, you can add comments in the same way as you did while writing the CSS code. Comment lines are placed between /* */
. Less also allows single-line comments that start with //
.
Using Less, you will conserve these comments in the final style sheet apart from the single-line comments, which are not printed. Minimizers will remove these comments in your final compiled style sheet. An example of this can be seen in the following code:
/* comments by Bass .mixins() { ~"this mixin is commented...