Skip to content
On this page

注释

¥Comments

Stylus 支持三种注释:单行、多行注释以及多行缓冲注释。

¥Stylus supports three kinds of comments: single-line, and multi-line comments, and multi-line buffered comments.

单行

¥Single-line

单行注释看起来像 JavaScript 注释,并且不会在生成的 CSS 中输出:

¥Single-line comments look like JavaScript comments, and do not output in the resulting CSS:

// I'm a comment!
body
  padding 5px // some awesome padding
// I'm a comment!
body
  padding 5px // some awesome padding

多行

¥Multi-line

多行注释看起来与常规 CSS 注释相同。但是,它们仅在未启用 compress 选项时输出。

¥Multi-line comments look identical to regular CSS comments. However, they only output when the compress option is not enabled.

/*

 * Adds the given numbers together.
 */
add(a, b)
  a + b
/*

 * Adds the given numbers together.
 */
add(a, b)
  a + b

多行缓冲

¥Multi-line buffered

未抑制的多行注释以 /*! 开头。这告诉 Stylus 无论压缩如何都输出注释。

¥Multi-line comments which are not suppressed start with /*!. This tells Stylus to output the comment regardless of compression.

/*!

 * Adds the given numbers together.
 */
add(a, b)
  a + b
/*!

 * Adds the given numbers together.
 */
add(a, b)
  a + b