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 变量?如果是,语法是什么?
我尝试了以下方法:
@mixin bleed($direction) { margin-#{$direction}: 10px; }
和
@mixin bleed($direction) { #{'margin-' . $direction}: 10px; }
没有运气。
作为参考,我正在使用 lib-sass,抛出的错误是Unknown word
Unknown word
@mixin margin($direction) { margin-#{$direction}: 10px; }
通过以下调用对我有用
.margin-test{ @include margin(right); }
给
.margin-test { margin-right: 10px; }