I'm trying to include Fontawesome with a Rails 4 app however the assets aren't making it into the asset pipeline. However, the fonts aren't making it out in production and I can't figure out why.
File structure organisation
All my assets are stored in /assets/components
so that Fontawesome appears in: /assets/components/font-awesome
(they're in a different directory because I'm using Bower).
CSS manifest file:
# application.css.scss
/* ...
*= require bootstrap/dist/css/bootstrap
*= require font-awesome/css/font-awesome
*= require_self
*= require_tree .
*/
Asset pipeline is set to precompile fonts
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.assets.paths << Rails.root.join('vendor', 'assets', 'components')
# Adding Webfonts to the Asset Pipeline
config.assets.precompile << Proc.new { |path|
if path =~ /\.(eot|svg|ttf|woff|otf)\z/
true
end
}
I added the precompile instructions so that the fonts would all be precompiled as per this question
Heroku 12 Factor gem is included
#gemfile
group :production do
gem "rails_12factor"
end
So what's the problem?
When I push to Heroku, it shows that the application is requesting the files but that they're not loading:
And looking at the logs it seems to be a routing issue - I would have expected the font to be served from /assets/fonts
but it is apparently looking in /fonts
app[web.1]: Started GET "/fonts/fontawesome-webfont.ttf?v=4.0.1" for 86.161.231.181 at 2013-10-29 15:53:01 +0000
app[web.1]: Started GET "/fonts/fontawesome-webfont.ttf?v=4.0.1" for 86.161.231.181 at 2013-10-29 15:53:01 +0000
app[web.1]:
app[web.1]: ActionController::RoutingError (No route matches [GET] "/fonts/fontawesome-webfont.ttf"):
Why aren't the assets getting served
I'm a bit confused with all of this. Why aren't these fonts being served?