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 规则中选择 mixins。
可用于递归嵌套类。说我要提取:
.my_class margin-top: 1px &+.m y_class margin-top: 0
进入
@mixin my_mixin margin-top: 1px; &+@any_class(my_mixin) margin-top: 0
这对你想做的事情有用吗?
萨斯:
@mixin my_mixin margin-top: 1px & + & margin-top: 0 h1 @include my_mixin
生成的 CSS:
h1 { margin-top: 1px; } h1 + h1 { margin-top: 0; }