SASS语法错误:未定义的变量:“$ em-base”

时间:2014-03-07 22:35:00

标签: sass mixins

我正在关注一个新的SASS structure guide here

尝试使用PX到EM mixin,似乎变量没有通过。 但我有 base 导入 mixins ,最后导入排版

主要SASS文件:

// Modules and Variables
@import "modules/base";

// Partials
@import "partials/normalize";
@import "partials/typography";

BASE.scss:

@import "colors";
@import "fonts";
@import "animation";
@import "mixins";

_mixins.scss:

/* PIXELS to EM */
// eg. for a relational value of 12px write em(12) when the parent is 16px
// if the parent is another value say 24px write em(12, 24)

// @include em(12);
@function em($pxval, $base: $em-base) {
    @if not unitless($pxval) {
        $pxval: strip-units($pxval);
    }
    @if not unitless($base) {
        $base: strip-units($base);
    }
    @return ($pxval / $base) * 1em;
}

最后_typography.scss:

// widget table headers
section header h1 {
    font-family: LatoRegular;
    font-size: em(18);
}
来自CodeKit的

错误:

Syntax error: Undefined variable: "$em-base".
    on line 6 of /assets/sass/partials/_typography.scss
    from line 38 of /assets/sass/dashboard.scss

1 个答案:

答案 0 :(得分:1)

$em-base未在您的任何文件中定义。