未定义的Mixin'if-rem'使用Susy CSS

时间:2013-11-16 12:11:18

标签: susy-compass

在尝试编译Susy / Compass文档时,我得到Undefined mixin 'if-rem'

正是这条线造成了它:

Line 35 of _grid.scss

我正在使用:

  • SASS 3.2.12
  • 指南针0.12.2
  • Susy 1.0.9

谢谢:)

1 个答案:

答案 0 :(得分:0)

与错误消息一样,您应该在包含它之前定义if-rem mixin。所以你有两个选择:

  • 将_unit.scss导入您的样式。这是包含if-rem mixin声明

    的可疑部分
    // Imports
    
    @import "compass/utilities/general/clearfix";
    @import "compass/css3/box-sizing";
    // add _unit.scss path here, or elsewhere before the @include
    @import "susy/units";
    
  • if-rem mixin直接包含在您的代码中,您还应该包含变量,否则if-rem mixin将返回错误:

    // Whether to output fallback values in px when outputting rems.
    $rem-with-px-fallback: true !default;
    
    // Here is the`if-rem` mixin declaration
    @mixin if-rem($property, $values, $use-px-fallback: $rem-with-px-fallback) {
      $has-rem: false;
      @each $value in $values { $has-rem: if(unit($value) == 'rem', true, $has-rem); }
      @if $has-rem { @include rem($property, $values, $use-px-fallback); }
      @else { #{$property}: $values; }
    }