Rails 4 can't find fonts in production

Viewed 1106

Scenario: I have a Rails 4.0.0 application, deploying with capistrano, which precompiles my assets on my production server.

Problem: I'm trying to add a font and use it with @font-face. It works locally, but not in production.

Error message: "Failed to load resource: the server responded with a status of 404 (Not Found) "

My fonts are located in app/assets/fonts/

My relevant files:

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")

I have looked for answers in several SO posts and other sources but I can't seem to get it right. Btw, I am not deploying on Heroku. What am I missing? I appreciate your help.

EDIT: In production, I find the fonts where I assume they should be: my-rails-app/current/public/@assets/fonts

1 Answers
Related