我想要做的是创建一个 mixin,它接受参数并使用一个或多个参数作为要包含的其他 mixin 的名称。
由于我不确定正确的术语,我将尝试通过示例进行解释:
@gradients{
light:#fafafa; //Should these also be prefixed with @?
dark:#888888;
}
@gradientBackground(@name,@height){
background-image:url('../img/gradients/{@name}-{@height}.png'); //this works
background-color:@gradients[@name];
}
.someBox{
@gradientBackground(light;150);
}
//Expected result:
.someBox{
background-image:url('../img/gradients/light-150.png'); //This works
background-color:#fafafa; //This doesn't work.
}
该图像有效,但我还没有弄清楚如何从@gradients
. 这可能吗?