Published on: 19 March, 2016

Understanding Comments in SASS

Posted by andy | 635 views 0 likes 0 favourites 0 comments
Tumblr Digg Google Plus

To write comment in SASS is exactly the same way you write in your css document file. There are two types of comments available in SASS, one is multiple comments and the other one is a single comment. The different in commenting in SASS is if you use only single line comment which is identified by double forward slash //, it will be ignored when we compile it to the css output file. While if it is a group comment which is identified by those comment code line /* your comment */, it will be keep in the css output file. Please see the example below and how it output result will be.

/* This comment will be kept when compiling into 
 * css file.
*/

$main_color: #000;

//set the background color to #000
//this comment will be removed when compile to css file
body{
	color:$main_color;
}

Once we compile the SASS file into the css file, the result of the comments in the css output file will be like below.

/* This comment will be kept when compile into 
 * css file.
*/

body{
	color:#000;
}

You can see now that every comment line starting with the // will be automatically removed when compile to css file.

Comments

There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.