μλ νμΈμ μ¬λ¬λΆ,
μ΄ κΈ°μ¬μμ λ³Ό μ μλ μ»¬λ¬ νλ νΈ κΈ°λ₯μ ꡬννλ €κ³ ν©λλ€.
http://erskinedesign.com/blog/friendlier-colour-names-sass-maps/
μ΄κ²μ κ²°κ³Ό μ½λμ λλ€
// config
$_color-base-grey: rgb(229,231,234);
$palettes: (
purple: (
base: rgb(42,40,80),
light: rgb(51,46,140),
dark: rgb(40,38,65)
),
grey: (
base: $_color-base-grey,
light: lighten($_color-base-grey, 10%),
dark: darken($_color-base-grey, 10%)
)
);
// Palette function,
<strong i="10">@function</strong> palette($palette, $tone: 'base') {
<strong i="11">@return</strong> map-get(map-get($palettes, $palette), $tone);
}
// in module styles
a {
color: palette(purple);
&:hover {
color: palette(purple, light);
}
}
λͺ¨λ μ§νκ° μ΄ μμ μ κ°λ¦¬ν€λ κ² κ°μ§λ§ μ΄ μ€λ₯κ° λ°μν©λλ€.
Warning: /Users/xxx/xxx//styles.scss:35: argument `$map` of `map-get($map, $key)` must be a map
μ λ Grunt Sass λ²μ - 0.16.1μ μ¬μ©νκ³ μμ΅λλ€.
μ΄λ€ μμ΄λμ΄?
λ§μ κ°μ¬
νμΈνμ΅λλ€! node-sass (unreleased)μ API μ ν¨κ» libsassμμ λ€μ(JSON) μ€λ₯κ° λ°μν©λλ€.
{
"status": 1,
"path": "c:/temp/foo3.scss",
"line": 18,
"column": 13,
"message": "argument `$map` of `map-get($map, $key)` must be a map\nBacktrace:\n\tc:/temp/foo3.scss:18, in function `map-get`\n\tc:/temp/foo3.scss:18, in function `palette`\n\tc:/temp/foo3.scss:24"
}
@mgreter , λ³λλ‘; JSONμ message
μμ νμΌ μ΄λ¦κ³Ό μ€ λ²νΈκ° λ°λ³΅λμ΄μλ μλ©λλ€. :)
λλ μ΄κ²μ νκ³ map-get($palettes, $palette)
μ΄ nullμ λ°ννκΈ° λλ¬Έμ λνλ¬μ΅λλ€.
μμ§ ν΄κ²° λ°©λ²μ΄ μλμ?
λλ μ΄κ²μ 3.0.3 μ΄μ νμ μΆκ°νλλ° λ€μ 릴리μ€μ ν¬ν¨λμ΄μΌ ν©λλ€.
μ μ΄κΈ° μκ°μ΄ μλͺ»λ κ² κ°μ΅λλ€. λ¬Έμ λ 맡 ν€κ° μμ μ΄λ¦μ΄κΈ° λλ¬Έμ λλ€. Libsassλ μμ μ΄λ¦(μ: https://github.com/sass/libsass/issues/558)μΈ λ¬Έμμ΄μ ꡬ문 λΆμν λ λͺ κ°μ§ λ¬Έμ κ°
μΆμ μ¬λ‘: http://sassmeister.com/gist/d2be1def3619bd6c3a54
μ°Έκ³ λ‘ μ§λ ν€μ μμμ΄ λ¬Έμμ΄μ΄ μλλΌ μμμ΄λΌλ μ μμ μ¬μ©μκ° sass/sass#363κ³Ό κ΄λ ¨λ λ¬Έμ λ₯Ό κ²ͺκ³ μλ κ² κ°μ΅λλ€.
λλ μ΄κ²μ΄ μ΄λ μ λ μ¬μ€μ΄λΌκ³ λ―Ώλλ€. μ§λ ν€κ° λ¬Έμμ΄μ΄ μλ μμμΌλ‘ μ²λ¦¬λκ³ μλ€κ³ μκ°νμ§λ§ μ΄κ²μ΄ μ λ¬Έμ μΈμ§ μ λͺ¨λ₯΄κ² μ΅λλ€.
μΆμλ ν μ€νΈ μΌμ΄μ€κ° Ruby sassμμ μ μλνλ€λ μ μ μ£Όλͺ©ν κ°μΉκ° μμ΅λλ€.
λ¬Έμ λ κ·Έ μ°λ¦° μΉλ£ purple
λ¬Έμμ΄λ‘μ§λ ν€μ purple
Aμ ν¨μ νΈμΆμ color
. map-get
νΈμΆν λ 보λΌμκ³Ό κ΄λ ¨λ κ°μ μμ²νμ§λ§ 보λΌμ λ¬Έμμ΄ μλμ μ μ₯λ©λλ€. μ΄ λ κ°μ§λ λλ±νμ§ μμ΅λλ€ - http://sassmeister.com/gist/77ae29d46ebecd0823ed
μμ μ¬νμ΄ μμ΄μ λͺ μκ° νμ λ°°μ‘ν΄ λλ¦¬κ² μ΅λλ€.
κ°μ₯ μ μ©ν λκΈ
μ μ΄κΈ° μκ°μ΄ μλͺ»λ κ² κ°μ΅λλ€. λ¬Έμ λ 맡 ν€κ° μμ μ΄λ¦μ΄κΈ° λλ¬Έμ λλ€. Libsassλ μμ μ΄λ¦(μ: https://github.com/sass/libsass/issues/558)μΈ λ¬Έμμ΄μ ꡬ문 λΆμν λ λͺ κ°μ§ λ¬Έμ κ°
μΆμ μ¬λ‘: http://sassmeister.com/gist/d2be1def3619bd6c3a54