场景:我有一个Rails 4.0.0应用程序,使用capistrano部署,它在我的生产服务器上预编译我的资产.
问题:我正在尝试添加字体并将其与@ font-face一起使用.它在本地工作,但不在生产中.
错误消息: "无法加载资源:服务器响应状态为404(未找到)"
我的字体位于app/assets/fonts /
我的相关文件:
应用程序/资产/样式表/ 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'); }
配置/ application.rb中:
config.assets.paths << Rails.root.join("app", "assets", "fonts")
我在几个SO帖子和其他来源中寻找答案,但我似乎无法做到正确.顺便说一句,我没有在Heroku上部署.我错过了什么?我感谢您的帮助.
编辑: 在生产中,我发现我认为它们应该是的字体:my-rails-app/current/public/@ assets/fonts