Does SCSS Support Inline Comments

Does SCSS support inline comments?

There are two different types of comments to consider in SASS.

  1. Single line comments // will be removed by the .scss pre-procesor, and won't appear in your .css file.
  2. Multiline comments */ are valid CSS, and will be preserved* between the translation from .scss to your .css file.

    • Except for some compressed modes, unless you start the comment with a !. See http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#comments.

It sounds like inline comments // are what you're looking for.

wrong auto comments for scss in vscode

I believe this is working as expected, as SCSS supports both ways to comment, and I do not think there are any settings in Visual Studio Code you can change to change how the comment style works.

Ctrl + / is "Toggle Line Comment", which is the // way. If you want to comment using the multi-line comment format, you can instead highlight what it is you want to comment, and perform Shift + Alt + A.

shift alt a way

However, there is another way to change how the Line Comments work:

  • Find where Visual Studio Code is installed on your system, and go to resources → app → extensions → scss
  • In the scss folder should be a "language-configurations.json" file. Open it.
  • Change the lineComment property to be either a blank string, or delete it outright.
"lineComment": ""
  • Save the file, and restart Visual Studio Code. Now when you perform Ctrl + /, it should comment using the style you prefer.

How to ignore comments in sass partial files?

If you use inline comments, they won't show up in your compiled file.

For example:

// Colors

How to add comments to inline CSS?

Use /* and */.

<span class="color_dark" style="top:20px; /*font-size: 17px;*/ line-height: 0px;position: relative;">onbezorgd genieten van uw<br> haard of kachel</span>

You can see that Google Chrome uses those too when disabling a style on a page.

And google your question next time first please.



Related Topics



Leave a reply



Submit