只是一个(希望)关于 LESS Mixins 的快速问题:这两个 mixin 可以以某种方式组合吗?因为它们共享许多相同的信息,所以只有一个添加了额外的颜色。
.gradient-top(@color-1, @color-2){
background-color: @color-2;
background: -webkit-linear-gradient(top, @color-1, @color-2);
background: -moz-linear-gradient(top, @color-1, @color-2);
background: -ms-linear-gradient(top, @color-1, @color-2);
background: -o-linear-gradient(top, @color-1, @color-2);
background: linear-gradient(top, @color-1, @color-2);
}
.gradient-middle(@color-1, @color-2, @color-3){
background-color: @color-2;
background: -webkit-linear-gradient(top, @color-1, @color-2, @color-3);
background: -moz-linear-gradient(top, @color-1, @color-2, @color-3);
background: -ms-linear-gradient(top, @color-1, @color-2, @color-3);
background: -o-linear-gradient(top, @color-1, @color-2, @color-3);
background: linear-gradient(top, @color-1, @color-2, @color-3);
}