场景: 我有一个使用Rails 4.0.0开发的应用程序,使用capistrano进行部署,并在生产服务器上预编译我的资源。
问题:我尝试添加字体并使用@font-face。 它在本地工作,但在生产中不起作用。
错误信息:“无法加载资源:服务器响应状态为404(未找到)”
我的字体位置在app/assets/fonts/ 相关文件:
我的字体位置在app/assets/fonts/ 相关文件:
app/assets/stylesheets/application.css.scss:
/*
* This is a manifest file yada yada yada...
*
*= require bootstrap
*= require_self
*= require_tree .
*/
@font-face {
font-family: 'stone_sansregular';
src: url(font-path('stone_sans_regular-webfont.eot') + "?#iefix") format('embedded-opentype'),
url(font-path('stone_sans_regular-webfont.woff')) format('woff'),
url(font-path('stone_sans_regular-webfont.ttf')) format('truetype'),
url(font-path('stone_sans_regular-webfont.svg') + "#stone_sansregular") format('svg');
}
config/application.rb:
config.assets.paths << Rails.root.join("app", "assets", "fonts")
我在多个SO帖子和其他来源中寻找答案,但似乎无法得到正确的结果。顺便说一下,我没有部署在Heroku上。请问我错过了什么?感谢你的帮助。
编辑:在生产环境中,我在这里找到了字体:my-rails-app/current/public/@assets/fonts