对于这种更少的代码,是否有SASS等价物?具有多种样式的变量

对于这种更少的代码,是否有SASS等价物?具有多种样式的变量,sass,Sass,Sass中是否有类似的东西我可以用来实现这一点 @discount-title:{ text-transform: uppercase; font-weight: 600; line-height: 14px; margin-bottom: 10px; }; .discount { @discount-title(); } 它们在Sass中被称为mixins 这是相同代码在sass中的外观: @mixin discount-title() { tex

Sass中是否有类似的东西我可以用来实现这一点

@discount-title:{
    text-transform: uppercase;
    font-weight: 600;
    line-height: 14px;
    margin-bottom: 10px;
};
.discount {
    @discount-title();
}
它们在Sass中被称为mixins

这是相同代码在sass中的外观:

@mixin discount-title() {
  text-transform: uppercase;
  font-weight: 600;
  line-height: 14px;
  margin-bottom: 10px;
}

.discount {
  @include discount-title();
}

除了你不需要,那就是@mixin折扣标题{stuff},.discount{@include折扣标题;}是的,没错!括号用于变量(如果有):P