Ruby on rails Rails 3.2.18,无法获取字体系列
我在fonts文件夹中创建了一个fonts.css.scss文件,格式如下Ruby on rails Rails 3.2.18,无法获取字体系列,ruby-on-rails,fonts,woff,eot,Ruby On Rails,Fonts,Woff,Eot,我在fonts文件夹中创建了一个fonts.css.scss文件,格式如下 @font-face { font-family: 'amandaregular'; src: url(font-path('amanda-webfont.eot')); } 它正在生成已编译的字体,但无法加载字体族 @font-face { font-family: 'amandaregular'; src: url("http://localhost:3000/assets/amanda-webfo
@font-face {
font-family: 'amandaregular';
src: url(font-path('amanda-webfont.eot'));
}
它正在生成已编译的字体,但无法加载字体族
@font-face {
font-family: 'amandaregular';
src: url("http://localhost:3000/assets/amanda-webfont.eot");
}
首先确保将fonts文件夹添加到config/application.rb中的资产管道加载路径,然后重新启动服务器:
config.assets.paths << Rails.root.join("app", "assets", "fonts")
请注意,上面使用了
最后,确保文件amanda-webfont.eot保存在app/assets/fonts中是的,我已经在application.rb中定义了,并且给定了“embedded-opentype”格式,但字体面没有更改我编辑了我的答案。您需要将font.css.scs保存在样式表文件夹中,但字体文件本身保存在字体文件夹中。
@font-face {
font-family: 'amandaregular';
src: url(font-path('amanda-webfont.eot?#iefix')) format('embedded-opentype');
}