μμνκΈ°μ μμ
βοΈ ν΄λΉ κΈμ .scss λ₯Ό κΈ°μ€μΌλ‘ μμ±λμμ΅λλ€!
.scssμ .sass νμ₯μμ λ°λΌ μ£Όμμ΄ λμνλ λ°©μμλ μ°¨μ΄κ° μμ§λ§
곡ν΅μ μΌλ‘ /**/λ‘ μμ±λλ μ£Όμμ cssλ‘ μ»΄νμΌλλ€λ μ , // λ‘ μμ±λ μ£Όμμ μ»΄νμΌ λμ§ μλλ€λ μ μ λμΌν©λλ€!
λμμΈ μμ€ν μ λ§λ€λ©΄μ scss μ¬μ©λ μ΅νλ μ€μ΄λ€.
μ¬λ¬ μλ£λ€μ μ°Έκ³ νλ λμ€ μ£Όμ μ€νμΌμ΄ μ‘°κΈμ© λ¬λλ€.
μ΄λ€ κ²½μ°μλ μ΄λ€ κ±Έ μ°λ μ§ κΆκΈν΄μ μ΄λ² ν¬μ€ν μμ λ€λ€λ³΄κΈ°λ‘ νλ€.
Scssμμμ μ£Όμ
scssμμ μ¬μ©νλ μ£Όμμ jsμμ λμνλ λ°©μκ³Ό μ μ¬νλ€.
// λ‘ μμνλ single-line comment(ν μ€ μ£Όμ)λ€μ cssμμλ silent commentλΌκ³ λ λΆλ¦¬λλ°, μ΄λ ν cssλ λ§λ€μ§ μκΈ° λλ¬Έμ΄λ€.
/**/λ‘ μμνλ multi-line comment(μ¬λ¬ μ€ μ£Όμ)λ statementκ° νλ½λλ κ³³μ μμ±λλ€λ©΄ css μ£ΌμμΌλ‘ μ»΄νμΌλλ€.
λ°λΌμ loud commentλΌκ³ λ λΆλ¦°λ€. multi-line commentμ cssλ‘ μ»΄νμΌλ κ²½μ° interpolationλ₯Ό ν¬ν¨ν μλ μλλ°, μ΄ κ²½μ° μ£Όμμ΄ μ»΄νμΌλκΈ° μ μ νκ°κ° λλ€.
κΈ°λ³Έμ μΌλ‘ multi-line commentμ compressed modeμμλ μ»΄νμΌλμ§ μλλ€.
λμ /*!*/λ‘ μμ±νλ©΄ 무쑰건 cssμ μ»΄νμΌλλ€.
// css νμΌμ μλ κ±°λ λ§μ°¬κ°μ§μΈ μ£Όμ νν
/* compressed modeμμλ μ»΄νμΌλμ§ μμ */
/* interpolation ν¬ν¨ κ°λ₯:
* 1 + 1 = #{1 + 1} */
/*! compressed modeμμλ ν¬ν¨λλ μ£Όμ */
p /* Multi-line comments λ whitespaceλ₯Ό μ¬μ©ν μ μλ μ΄λλ μ§ μΈ μ μλ€ */ .sans {
font: Helvetica, // single-line commentλ λ§μ°¬κ°μ§λ€
sans-serif;
}
Documentation Comments
sass λΌμ΄λΈλ¬λ¦¬λ₯Ό μ¬μ©ν λ λΌμ΄λΈλ¬λ¦¬κ° μ 곡νλ mixin, functions, variables κ·Έλ¦¬κ³ placeholder selectorμ λΌμ΄λΈλ¬λ¦¬ κ·Έ μ체μ λν Documentation Comments(λ¬Έμνμ© μ£Όμ)μ λ¬ μ μλ€. SassDocs λꡬλ₯Ό νμ©νλ©΄ μ½κΈ° μ½κ² λ¬Έμνλ λ²μ μ μ½μ μ μλ€.
Documentation Commentsμ silent commentμ ν΄λΉλλ€.
/// λ‘ λ¬Έμννκ³ μνλ κ² λ°λ‘ μμ μμ±νλ©΄ λλ€. λ¬Έμνλ μ£Όμλ€μ λ§ν¬λ€μ΄μΌλ‘ νμ± λκ³ , annotationμ μ§μνλ€.
/// Computes an exponent.
///
/// @param {number} $base
/// The number to multiply by itself.
/// @param {integer (unitless)} $exponent
/// The number of `$base`s to multiply together.
/// @return {number} `$base` to the power of `$exponent`.
@function pow($base, $exponent) {
$result: 1;
@for $_ from 1 through $exponent {
$result: $result * $base;
}
@return $result;
}
π€ μ΄λ²μλ κ°λ¨νκ² scss μμ μ£Όμμ μ°¨μ΄μ λν΄μ μ΄ν΄λ΄€λ€.
// μ css κ²°κ³Όμ ν¬ν¨λμ§ μλ μ£Όμ, /**/μ compressed modeκ° μλ κ²½μ° μ»΄νμΌλκ³ , /*!*/λ 무쑰건 μ»΄νμΌλλ μ£Όμμ΄λ€.
λ€μμλ sassdocμ λν΄ λ μμλ³΄κ³ μ μ©μ ν΄λ³΄μ.
π References
https://sass-lang.com/documentation/syntax/comments/
Sass: Comments
The way Sass comments work differs substantially between SCSS and the indented syntax. Both syntaxes support two types of comments: comments defined using /* */ that are (usually) compiled to CSS, and comments defined using // that are not. Comments in SC
sass-lang.com