seyhunak / twitter-bootstrap-rails

Twitter Bootstrap for Rails 6.0, Rails 5 - Rails 4.x Asset Pipeline
https://github.com/seyhunak/twitter-bootstrap-rails
4.5k stars 998 forks source link

Use font-awesome-rails gem instead of copy-pasting FontAwesome #796

Closed charredUtensil closed 9 years ago

charredUtensil commented 9 years ago

I had a bit of trouble getting fontawesome to work properly. Specifically, this involved the asset pipeline and something similar to #740, #730, #667, and #733 - it seems that's an issue with a number of people with no well-documented way to fix it.

I ended up using the font-awesome-rails gem in place of this gem's implementation and everything was fine. It makes more sense to me to use another working project as a dependency, instead of having to maintain this in the codebase.

toadkicker commented 9 years ago

Re: #740

it's nothing to do with the bootstrap rails gem

Re: #730

I've updated to Rails 3.2, Configured asset pipeline according to the Rails guide asset pipeline. Works now as expected.

Re: #667

no response from OP and later issues covered fixes

Re: #733

changed paths in their apps, so fontawesome reference was somewhere else

I don't know what your goals are for your project or how you have this gem configured. Perhaps you can give us more information. This gem gives developers a lot of control over FontAwesome, and you're not gaining anything by having another gem provide it. I don't know why you would want two copies in your project of FontAwesome.

I'm all for figuring out a better way to manage external dependencies, so if you have a proposal for that feel free to open the discussion with more details than you've brought up here. Even better, close this issue and open a PR with how you would like to solve this issue. Most PR's, if they are good quality, are accepted within a few days of their post. I respect developer's time immensely, and a contribution here is the best thank you the community can offer.

charredUtensil commented 9 years ago

Makes sense, and perhaps the solution is to change the generator or provide better documentation about this issue, since this is clearly a common problem among users, regardless of something wrong with the gem itself.

For my own experience, I set up a new Rails 4 project, followed all the documentation listed here, and when I staged the project, I got 404s from all requests for fontawesome font files. I checked over the documentation, and finding nothing of use looked into any open issues, then closed issues. I was met with those four, which had rather vague suggestions. I followed all of them best I could but didn't arrive anywhere useful. This is the (rather concrete) solution I came up with: Remove fontawesome from bootstrap_and_overrides.css and install a separate gem, which had no problems staging its assets.

font-awesome-rails uses font_path instead of asset_path for the font files, which may be related: https://github.com/bokmann/font-awesome-rails/search?utf8=%E2%9C%93&q=font_path

I'll have more time to investigate this next week.

toadkicker commented 9 years ago

If font_path is a better solution, I welcome a PR that covers that. If we can test it so that 404's don't happen thats even better. For what it is worth, I maintain a reference app and it is running on heroku with FontAwesome in use. Give it a whirl, if you can duplicate the issue with that we can figure out a permanent solution.

charredUtensil commented 9 years ago

Huh. It's actually broken on your test app right now. I edited in a <i class="fa fa-check"></i> with Chrome. It fails to display the icon and 404s trying to load all the FA fonts. I've noticed Chrome at the very least doesn't actually load fonts unless they're used.

toadkicker commented 9 years ago

Might be worth it for us to incorporate https://github.com/FortAwesome/font-awesome-less as a git submodule instead of a gem

toadkicker commented 9 years ago

You're right, it isn't loading it. I'm seeing the 404 in teststrap as well. It's late here in, I'll pick this up in the morning. I don't know why Rails::Engine wouldn't add them from [gem]/app/assets/fonts, but that appears to be the case. I'll have to read up on what Rails 4 expects this to be for it to work properly.

toadkicker commented 9 years ago

Looks like they need to be added to the precomplie config. Looking around at other gems they're adding them manually:

https://github.com/rails-assets/rails-assets/pull/152/files

toadkicker commented 9 years ago

Ok I'm going to propose closing this in favor of #798 if that is ok with you. I agree the copy/pasting of these has caused a mess, and I think bower is a better solution for the gem to handle this.

toadkicker commented 9 years ago

@charredUtensil I created railsstrap and solved these issues. Give it try!