波旁威士忌的@ font-face mixin [英] Bourbon's @font-face mixin

查看:135
本文介绍了波旁威士忌的@ font-face mixin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是波旁& amp; amp;的新手. SASS并尝试使用 @ font-face mixin 添加我下载的字体(Museo Sans )到我的Rails 3应用.

I'm new to Bourbon & SASS and trying to use the @font-face mixin to add a font I downloaded (Museo Sans) to my Rails 3 app.

波旁威士忌提供以下示例:

Bourbon provides the following examples:

@include font-face(SourceSansPro, '/fonts/Source_Sans_Pro/SourceSansPro-Regular');
@include font-face(SourceSansPro, '/fonts/Source_Sans_Pro/SourceSansPro-Bold', bold);
@include font-face(SourceSansPro, '/fonts/Source_Sans_Pro/SourceSansPro-Italic', normal, italic);

// Rails asset-pipeline - place fonts in app/assets/fonts/
@include font-face(SourceSansPro, 'Source_Sans_Pro/SourceSansPro-Regular', normal, $asset-pipeline: true);

我做了什么:

// application.css.scss
@import "bourbon";
@import "fonts";

// fonts.css.scss
@include font-face(MuseoSans, '/fonts/MuseoSans/MuseoSans_500-webfont', normal, $asset-pipeline: true);

* { 
  font-family: MuseoSans;
}

字体位于Assets/fonts/MuseoSans/中,其文件名如MuseoSans_500-webfont.eot,.ttf等.我的印象是您可以不使用扩展名,而Bourbon应该可以提取所有文件.

The fonts are in assets/fonts/MuseoSans/ with filenames like MuseoSans_500-webfont.eot, .ttf, etc. I get the impression you can leave off the extension and Bourbon is supposed to pick up all the files.

我尝试了上述方法的许多不同变体,但均无济于事.我知道波旁威士忌和文件都可以正常工作,因为当我将字体系列设置为$ helvetica时,页面上会看到一个变化.

I've tried a lot of different variants of the above to no avail. I know that Bourbon and the files are working because when I set the font-family to $helvetica I see a change on the page.

如果任何人都可以提供适当的代码,或者我可以看的GitHub项目,我将非常有义务.

If anyone can provide the proper code, or a GitHub project that I could look at, I'd be much obliged.

推荐答案

尝试删除路径中的前导"/fonts",例如:

Try removing the leading "/fonts" in your in your path like:

@include font-face(MuseoSans, 'MuseoSans/MuseoSans_500-webfont', normal, $asset-pipeline: true);

这篇关于波旁威士忌的@ font-face mixin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆