2016-07-27 70 views
0

我无法弄清楚为什么我不能让mixin工作。你可以看看下面的信息,看看有什么不对。这些是我的sass页面,它们包含相关的代码。代码套件中未定义的混合错误

**Style.sass** 
@import "components/typography" 
@import "components/tables" 

**_typography.sass** 
@mixin bold-caps 
    font-weight: 700 
    text-transform: capitalize 

**_tables.sass** 
p 
    @include bold-caps 
+0

你可以发布你的SASS预编译器是记录错误? – Lowkase

+0

错误:未定义的mixin'粗体大写'。 在/Users/krisjones/Desktop/style/components/_tables.sass的第8行,在/Users/krisjones/Desktop/style/components/_tables.sass的第8行的'bold-caps'中,来自第8行的/用户/ krisjones/Desktop/style/style2.sass 使用--trace进行回溯。 –

+0

尝试下面我的帖子中的代码...我只是在mixin声明和mixin调用中添加了“()”...我很确定这是抛出错误的东西 – Lowkase

回答

0
// Style.sass 
@import "components/typography"; 
@import "components/tables"; 

//_typography.sass 
@mixin bold-caps() { 
    font-weight: 700; 
    text-transform: capitalize; 
} 

//_tables.sass 
p { 
    @include bold-caps(); 
} 
+1

尽管此代码可能会回答这个问题,但提供有关* how *和/或* why *解决问题的其他上下文会提高答案的长期价值。 –