Unable to get font-awesome in production with Rails 5.1
ankitsinghaniyaz opened this issue ยท 12 comments
I am using font-awesome-rails
gem and everything works fine in development. In production, I am not able to get the file to work. It is looking for the http://forme-dev.us-west-2.elasticbeanstalk.com/assets/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.ttf
I have few doubts! Will this file be compiled into public/assets
? If yes, then it is not present there!
Here is how I am importing it in my application.scss
:
@import "font-awesome";
Can you help me if I am missing something? Thanks.
I don't think our test suite covers Rails 5.1 yet (though we should add support for it more explicitly soon).
Based on your report, it sounds like you have config.action_controller.asset_host
configured in production to point to a CDN.
http://edgeguides.rubyonrails.org/asset_pipeline.html#cdns
Assets only get compiled into public/assets if rake assets:precompile
is first run during a deploy:
http://edgeguides.rubyonrails.org/asset_pipeline.html#precompiling-assets
I have the same issue with Font Awesome and Rails 5.1 (I'm running it on Heroku with default production.rb):
- http://[hidden].herokuapp.com/assets/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2 - 404 Not Found
- http://[hidden].herokuapp.com/assets/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff - 404 Not Found
- http://[hidden].herokuapp.com/assets/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf - 404 Not Found
I didn't change the default Heroku build process (everything is working as usual).
I haven't verified any of this myself as I don't have an app that I can take to Rails 5.1 at the moment, but it sounds like we might have some work to do to get things running as expected on Rails 5.1.
I'm currently traveling for family matters this week and next. If I find a hunk of down time, I might give this a go, but I can't make any promises as of yet.
A pull-request to remedy this, with new additions to the Travis-CI build matrix, would be very much welcome and super helpful!
Rails 5.1 is been released and I have this error if I want use last version of gem:
font-awesome-rails (~> 4.7) was resolved to 4.7.0.0, which depends on
railties (< 5.1, >= 3.2) x64-mingw32
The problem is probably in gemspec on
gem.add_dependency "railties", ">= 3.2", "< 5.1
+1
Using it with Rails 5.1.rc2 and the require method ...
/*
*= require font-awesome
*/
... everything works well.
A pull-request to remedy this, with new additions to the Travis-CI build matrix, would be very much welcome and super helpful!
I added a PR with rails 5.1. support and updated travis matrix (#185). But I don't have any problems on production, so cannot investigate it - for me it works.
Hi all. I just merged @doits additions to make the dependencies compatible with Rails 5.1. Because there's some uncertainty about whether things fully work in Rails 5.1, could everyone please first try their applications on the master branch (I'm in a bit of a bind this week and don't have much time to dig in on a real application just yet). Please update your Gemfile
(temporarily) to read:
gem "font-awesome-rails", github: "bokmann/font-awesome-rails", branch: "master"
And let me know the results. If I get enough positive confirmations, I'll publish an official versioned release of font-awesome-rails with Rails 5.1 support.
Thanks!
The 5.1 compatible branch is causing zero issues in my application.
gem "font-awesome-rails", github: "bokmann/font-awesome-rails", branch: "master"
And let me know the results. If I get enough positive confirmations, I'll publish an official versioned release of font-awesome-rails with Rails 5.1 support.
Works for me, I'm running Rails 5.1.0
404 fresh gem install on Rails 5.0 and 5.2. It is trying to access /fonts
, no mention of /assets
. ?
http://localhost:3000/fonts/fontawesome-webfont.woff?v=4.2.0