IMG-LOGO

Understanding Comments in SASS

andy - 19 Mar, 2016 2744 Views 0 Comment

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.

Related Blogs

Related Tutorials

SASS Math Calculation

Sass does support math calculation on the fly for your document css. The calculation technique is useful especially you want to automatically set a specific width based on percentage calculation. The supported formula includes adding, subtracting, multiplying and dividing.

Introduction to Sass

Learn what is Sass and how you can now easily manage your css files with Sass. In this tutorial, you will learn your first Sass and how to install in Windows.

SASS Basic

You will learn the SASS basic features and how it can easily help you creating the fast and elegant way in css Once you know how to use it you will never want to style in the old way you ...