【问题标题】:equivalent in sass of iscolor in less相当于 iscolor 的 sass in less
【发布时间】:2014-04-08 05:20:08
【问题描述】:

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

我的签到是这样的:

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

sass

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

【问题讨论】:

    标签: sass less


    【解决方案1】:

    文档有丰富的信息(参见: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;
        }
    }
    

    【讨论】:

    • 嗯,有意思,没想到还有字体颜色!非常感谢您的帮助
    猜你喜欢
    • 1970-01-01
    • 2014-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-03
    • 2012-02-11
    • 2012-03-10
    相关资源
    最近更新 更多