我想知道是否有办法模仿sass / scss中较少的函数iscolor。
我还没有在文档中找到这个功能,但我希望有办法做到这一点。
我的入住费用是这样的:
.myfunction(@color) when (iscolor(@color)){
color:@color;
}
SASS
@mixin myfunction($color){
//function to check if color is a real color
}
答案 0 :(得分:4)
文档中包含大量信息(请参阅:http://sass-lang.com/documentation/Sass/Script/Functions.html)
@mixin myfunction($color){ // functions and mixins are very differen't things
@if type-of($color) == color {
@debug yep;
}
}