Sass / Bourbon .css输出与@ font-face mixin有错误

时间:2014-06-25 01:55:23

标签: sass mixins bourbon

我使用默认的Sass / Bourbon mixin font-face.scss,但生成的css错误,因为某些原因将body标记嵌套在@font-face下。我生成CSS时没有错误,但字体当然没有显示。

有什么想法吗?

CSS输出:

@font-face {
    body {
        font-family: AgencyFB Regular;
        font-weight: normal;
        font-style: normal;
        src: url("../../fonts/agency/agencyfb_regular.eot");
        src: url("../../fonts/agency/agencyfb_regular.eot?#iefix") format("embedded-opentype"), 
         url("../../fonts/agency/agencyfb_regular.woff") format("woff"), 
         url("../../fonts/agency/agencyfb_regular.ttf") format("truetype"), 
         url("../../fonts/agency/agencyfb_regular.svg#AgencyFB Regular") format("svg"); 
    } 
}

SCSS:

body {
@include font-face(AgencyFB Regular, "fonts/agency/agencyfb_regular");  
font: $body-font-size;
line-height: $body-line-height;
}

1 个答案:

答案 0 :(得分:0)

Cimmanon的链接指出了我正确的方向进行修复。谢谢!

基本上我将@include font-face(AgencyFB Regular, "fonts/agency/agencyfb_regular");移到任何css标签之外(即:body)。

然后在font-family: AgencyFB Regular标记中添加了body

像这样:

@include font-face(AgencyFB Regular, "fonts/agency/agencyfb_regular");

body {
    font-family: AgencyFB Regular;      
    font: $body-font-size;
    line-height: $body-line-height;
}