bokmann / font-awesome-rails

the font-awesome font bundled as an asset for the rails asset pipeline
http://fortawesome.github.com/Font-Awesome/
MIT License
1.86k stars 244 forks source link

Unable to get font-awesome in production with Rails 5.1 #183

Closed ankitsinghaniyaz closed 7 years ago

ankitsinghaniyaz commented 7 years ago

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.

rmm5t commented 7 years ago

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

andreas-sotnik commented 7 years ago

I have the same issue with Font Awesome and Rails 5.1 (I'm running it on Heroku with default production.rb):

I didn't change the default Heroku build process (everything is working as usual).

rmm5t commented 7 years ago

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!

francesco-loreti commented 7 years ago

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

shlima commented 7 years ago

+1

doits commented 7 years ago

Using it with Rails 5.1.rc2 and the require method ...

/*
 *= require font-awesome
 */

... everything works well.

doits commented 7 years ago

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.

rmm5t commented 7 years ago

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!

trueheart78 commented 7 years ago

The 5.1 compatible branch is causing zero issues in my application.

tuomasj commented 7 years ago

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

rmm5t commented 7 years ago

font-awesome-rails v4.7.0.2 was just published.

damien-roche commented 5 years ago

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