5 | Commenting |
Comments are snippets of text that are ignored by the browser. Sass gives us the option of two types of comments. One will only show up in the Sass document, and the other will be incorporated into the CSS that’s compiled.
The comment style that’s compiled into the CSS is the same one you’re probably used to—in fact, it’s exactly the same as the CSS comment style. Just place your comment between /* and */. These comments can be on multiple lines.
If we want to write a comment that will only appear in the Sass file, then we place the comment after //. This style only works for single-line comments, though.
What To Do... |
basics/comments.scss | |
| /* Hey look at this multiline comment |
| * that we want to show up in our CSS |
| * output. */ |
| |
| #page { |
| color: black; } |
| |
| // These comments are single lines |
| // and we do not want them to appear |
| // in our CSS |
| |
| #sidebar { |
| color: #336699; } |
This compiles to:
| /* Hey look at this multiline comment |
| * that we want to show up in our CSS |
| * output. */ |
| #page { |
| color: black; } |
| |
| #sidebar { |
| color: #336699; } |