每一個旨在代碼庫中復(fù)用的變量、函數(shù)、混合宏和占位符,都應(yīng)該使用SassDoc?記錄下來作為全部 API 的一部分。
/// Vertical rhythm baseline used all over the code base.
/// @type Length
$vertical-rhythm-baseline: 1.5rem;
需要三個反斜杠(/
)
SassDoc 主要有兩個作用:
本文檔由 SassDoc 生成
這里有一個深入整合 SassDoc 生成文檔的例子:
/// Mixin helping defining both `width` and `height` simultaneously.
///
/// @author Hugo Giraudel
///
/// @access public
///
/// @param {Length} $width - Element’s `width`
/// @param {Length} $height ($width) - Element’s `height`
///
/// @example scss - Usage
/// .foo {
/// @include size(10em);
/// }
///
/// .bar {
/// @include size(100%, 10em);
/// }
///
/// @example css - CSS output
/// .foo {
/// width: 10em;
/// height: 10em;
/// }
///
/// .bar {
/// width: 100%;
/// height: 10em;
/// }
@mixin size($width, $height: $width) {
width: $width;
height: $height;
}
更多建議: