0
使用跨浏览器渐变@mixin我一直追着我的尾巴超过两个小时。SASS渐变@mixin让我疯狂
我想要得到这样的结果:
-moz-linear-gradient(left, #fff 0%, #000 100%);
从提供的默认参数:
@mixin gradient($type:linear, $gradient:(#fff 0%, #000 100%), $shape:vertical, $repeat:false){
background:nth(nth($gradient, 1), 1);
$background:null;
$vendors:null;
@if $shape == vertical {
$vendors: (
mozilla: (-moz-, top),
webkit: (-webkit-, top),
opera: (-o-, top),
standard: ("", to bottom)
);
}@else if $shape == horizontal {
$vendors: (
mozilla: (-moz-, left),
webkit: (-webkit-, right),
opera: (-o-, right),
standard: ("", to right)
);
}@else{
$vendors: (
mozilla: (-moz-, $shape),
webkit: (-webkit-, $shape),
opera: (-o-, $shape),
standard: ("", to $shape)
);
}
@if $repeat == true{
$background:repeating-+$type+-gradient;
}@else if $repeat == false {
$background:$type+-gradient;
}
@if $type == linear {
@each $vendor in $vendors {
background:[?????];
}
}@elseif $type == radial {
@each $vendor in $vendors {
background:[?????];
}
}
}
我会很感激在这一个帮助之前,我砸我的笔记本电脑与我头!
就个人而言,我只想写混入然后运行autoprefixer并让它担心前缀。只需做这样的事情“=颜色($ color1,$ color2,$ color3) \t背景:线性渐变($ color1,$ color2,$ color3)”并将其余的需求作为变量添加。然后在使用mixin时插入变量 – Brad