Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在 Sass 中使用另一个变量来引用一个变量?我想做这样的事情:
$gray = #ccc; $white = #fff; @each $color in gray, white { div_#{$color} { // works fine color: #{$#{$color}}; // fails } }
我尝试了所有我能想到的变化来使插值起作用并且没有骰子。有谁知道这是否可能?谢谢!
Sass 现在有 maps,所以你可以这样做:
$colors: (gray: gray, white: white);
然后循环通过它。
但是您不能在插值中进行插值。