Now here's a twist:
You should place all fonts in
app/assets/fonts/
as they WILL get precompiled in staging and production by default—they will get precompiled when pushed to heroku.Font files placed in
vendor/assets
will NOT be precompiled on staging or production by default — they will fail on heroku. Source!
— @plapier, thoughtbot/bourbon
I strongly believe that putting vendor fonts into
vendor/assets/fonts
makes a lot more sense than putting them intoapp/assets/fonts
. With these 2 lines of extra configuration this has worked well for me (on Rails 4):
app.config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
app.config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/
— @jhilden, thoughtbot/bourbon
I've also tested it on rails 4.0.0
. Actually the last one line is enough to safely precompile fonts from vendor
folder. Took a couple of hours to figure it out. Hope it helped someone.