跳至内容
在此页面上

注释

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

单行

单行注释看起来像 JavaScript 注释,并且不会输出到结果 CSS 中

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

多行

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

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

多行缓冲

未被禁止的多行注释以 `/*!` 开头。这告诉 Stylus 无论是否压缩都要输出注释。

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