In Sass, what comments are compiled into CSS and what comments are not?

Experience Level: Junior
Tags: Sass

Answer

Single line comments starting with // are removed and won't be added to the CSS output.

Multi-line comments /* */ are preserved and will be added to the CSS output 

Sass
// This comment won't be in the CSS after compilation.
.button {
  border: solid 1px black;
  background-color: whitesmoke;
}

/* This comment will
be in the CSS after compilation */
body {
  color: green;
}
CSS
.button {
  border: solid 1px black;
  background-color: whitesmoke;
}

/* This comment will
be in the CSS after compilation */
body {
  color: green;
}

Comments

No Comments Yet.
Be the first to tell us what you think.
Sass for beginners
Sass for beginners

Are you learning Sass ? Try our test we designed to help you progress faster.

Test yourself