Sass 支持標準的CSS多行注釋以
/* */
以及單行注釋
//
。在盡可能的情況下,多行注釋會被保留在輸出的CSS中,而單行注釋會被刪除。 例如:
/* This comment is * several lines long. * since it uses the CSS comment syntax, * it will appear in the CSS output. */ body { color: black; } // These comments are only one line long each. // They won't appear in the CSS output, // since they use the single-line comment syntax. a { color: green; }
編譯為:
/* This comment is * several lines long. * since it uses the CSS comment syntax, * it will appear in the CSS output. */ body { color: black; } a { color: green; }
如果多行注釋的第一個字母是
!
,那么注釋總是會被保留到輸出的CSS中,即使在壓縮輸出模式下。這可用于在你生成的CSS中添加版權聲明。
使用插值語句 (interpolation) ,可以將變量值輸出到多行注釋中,例如:
$version: "1.2.3"; /* This CSS is generated by My Snazzy Framework version #{$version}. */
編譯為:
/* This CSS is generated by My Snazzy Framework version 1.2.3. */