fotanus
fotanus

Reputation: 20116

sass comment on the right of a code

I would like to have the following structure:

sass: rule //coment

But comments with // seems to be accepted only on new lines.

Is there a way to comment a sass rule in the same line the rule is?

Upvotes: 0

Views: 107

Answers (2)

Skäggiga Mannen
Skäggiga Mannen

Reputation: 1043

Yes you can. But only on new lines, or after a property:value pair. Perhaps an obscure bug, but they can break on compile if added after a selector. This May be fixed in a more recent version of SASS, so if you're having compile problems with comments, check the positioning as stated below (or update your version).

i.e.

// This works
.myclass
    width: 30px //comment

// This breaks for some on compile
.myclass //comment
    width: 30px

// This style is sass only and won't be compiled/output in the final css file
/* this style will be seen in final css file as a normal css comment */

Upvotes: 1

Matt Cain
Matt Cain

Reputation: 5768

The alternative way of writing comments is like this:

/* comment text here */

Be aware that this type of comment will be preserved in your generated css though, unless you use the compressed option.

Upvotes: 2

Related Questions