[英]Rails 3.2.18, Unable to get font-family
I created a fonts.css.scss file in fonts folder and given below format 我在fonts文件夹中创建了fonts.css.scss文件,并给出以下格式
@font-face {
font-family: 'amandaregular';
src: url(font-path('amanda-webfont.eot'));
}
it's generating with compiled fonts, but unable to load font-family 它使用编译的字体生成,但无法加载字体家族
@font-face {
font-family: 'amandaregular';
src: url("http://localhost:3000/assets/amanda-webfont.eot");
}
First make sure you add the fonts folder to the Asset pipeline load path in config/application.rb , and then restart your server: 首先确保将fonts文件夹添加到config / application.rb中的Asset管道加载路径,然后重新启动服务器:
config.assets.paths << Rails.root.join("app", "assets", "fonts")
Then place fonts.css.scss in app/assets/stylesheets and make sure it is included in your application.scss manifest. 然后将fonts.css.scss放在app / assets / stylesheets中 ,并确保它包含在application.scss清单中。 It should look like:
它应该看起来像:
@font-face {
font-family: 'amandaregular';
src: url(font-path('amanda-webfont.eot?#iefix')) format('embedded-opentype');
}
Notice the above uses the Fontspring @font-face syntax . 注意,上面使用了Fontspring @ font-face语法 。
Finally, make sure that the file amanda-webfont.eot is saved in app/assets/fonts 最后,确保将文件amanda-webfont.eot保存在app / assets / fonts中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.