我发现在SASS中经常会写一些模式,这表明这是一个完美的自动化场所。
即。
.some-selector {
border-top-color: rgba(255,255,255, .2);
border-bottom-color: rgba(255,255,255, .2);
}
我不想定义以下内容:
@mixin highlightBorder($red: 255, $blue: 255, green: 255, alpha: .2) {
border-top-color: rgba($red, $blue, $green, $alpha);
border-bottom-color: rgba($red, $blue, $green, $alpha);
}
相反,我试图理解如何写这个:
@mixin highlightThis($what) {
$what : rgba(255, 255, 255, .2);
}
在某些方面,感觉它应该就是这么简单,但mixin不会产生任何输出。这种mixin的正确语法是什么?
如果这是重复的话,请提前道歉,我确实做了一些搜索和测试,但找不到匹配。