相当于iscolor的sass in less

时间:2014-03-05 21:33:26

标签: sass less

我想知道是否有办法模仿sass / scss中较少的函数iscolor。
我还没有在文档中找到这个功能,但我希望有办法做到这一点。

我的入住费用是这样的:

.myfunction(@color) when (iscolor(@color)){
    color:@color;
}

SASS

@mixin myfunction($color){
   //function to check if color is a real color
}

1 个答案:

答案 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;
    }
}