0
votes

Trying to serve fonts from a deployed Rails 3.2 app that works in development. Example url:

http://app.code-london.co.uk/assets/146726/F3360BA8197ED501A.css

(located in app/assets/fonts/146726/)

Results in 404.

I recently added:

Application.rb:

config.assets.paths << Rails.root.join("app", "assets", "fonts")

Production.rb:

config.serve_static_assets = true

FWIW the location does not have to be /assets, but what is needed to get heroku serving those font files?

This is a requirement by the typography.com set up (http://www.typography.com/cloud/user-guide/moving-to-production)

Edit I have just found out that the .eot files are being served, its just the .css files that are not. Suggests something in the asset pipeline that I don't know about?

1
Could this be because the asset pipeline adds the fingerprint to the url? i.e. your CSS file would now be something like F3360BA8197ED501A-908e25f4bf641868d8683022a5b62f54.css - Chris O'Sullivan
it did that for all the font files (.eot etc) but not for the .css - they were none existent - jenson-button-event

1 Answers

2
votes

The trick was to add a fonts directory to the {app}/public folder.

The css files are now served as is (http://{site}/fonts/{folder}), and the font foundry is a happy bunny. (/public is not in browser path)