Sass变量类型处理

时间:2014-10-31 00:37:00

标签: css sass

我怎么能按照我的预期让它发挥作用?

// https://github.com/thoughtbot/bourbon/blob/master/app/assets/stylesheets/addons/_size.scss
@mixin size($size) {
    $height: nth($size, 1);
    $width: $height;
    @if length($size) > 1 {
        $height: nth($size, 2);
    }
    @if $height == auto or (type-of($height) == number and not unitless($height)) {
        height: $height;
    }
    @if $width == auto or (type-of($width) == number and not unitless($width)) {
        width: $width;
    }
}

$height:10;

.sample {
    @include size(10px $height + px)
}

我希望输出为:

.sample {
    height: 10px;
    width: 10px;  
}

http://sassmeister.com/gist/2bc77fdb2d5a7d656cf6

0 个答案:

没有答案