跳至內容
在此頁面

註解

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