【发布时间】:2015-06-24 02:04:18
【问题描述】:
我在 Sass 中有一个包含键和值的地图
$colors: (blue: #0081d2, green: #288600, orange: #e57323);
@each $color, $value in $colors {
.#{$color} {
color: $value;
}
}
这可行,并为我提供了具有适当值的 css 类名,例如:
.blue{
color: #0082d1;
}
希望有一个函数,它根据映射中的键生成 sass 变量。
$blue: #0082d1;
$green: #288600;
我一直在摔头,但无法让它发挥作用。
【问题讨论】:
标签: css variables dictionary sass