CSS SCSS 支持内联注释吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13355989/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 20:45:37  来源:igfitidea点击:

Does SCSS support inline comments?

csssass

提问by Jitendra Vyas

Can I keep an inline comment like this in my .scssfile

我可以在我的.scss文件中保留这样的内联注释吗

thead {
    display: table-header-group; // h5bp.com/t
}

I don't want this comment in my CSS output.

我不希望在我的 CSS 输出中出现此评论。

回答by KatieK

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

在 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.

  1. 单行注释//将被 .scss 预处理器删除,并且不会出现在您的 .css 文件中。
  2. 多行注释*/是有效的 CSS,将在从 .scss 到 .css 文件的翻译之间保留*。

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

听起来//您正在寻找内联注释。

回答by simhumileco

Yes, you can do it in SCSS.

是的,您可以在SCSS 中做到这一点。

Use inline comment: //.

使用内联注释://.

The single-line comments are removed in the CSS output.

在 CSS 输出中删除了单行注释。