Font awesome icons not showing using font-awesome-rails gem

陌路散爱 提交于 2019-12-10 18:03:51

问题


I can't seem to find an answer that works for me.

The icon shows up as a box: 

I'm using:

font-awesome-rails (4.6.2.0)
rails (4.2.3)

I imported font-awesome-rails in my application.scss file using:

@import "font-awesome";

and here is what I wrote for the view:

<i class="quote-left fa fa-quote-left"></i>

I've tried including it before and after bootstrap.

I also tried manually adding the font folder to the pipeline in application.rb

config.assets.paths << Rails.root.join("app", "assets", "fonts")

Clearing the tmp folder didn't seem to do anything either.

I spent way too much time on this, please help :(


回答1:


Try restarting your webserver, after adding @import 'font-awesome.css' to your application.scss.

Also read these, if you haven't yet,

https://github.com/bokmann/font-awesome-rails/issues/130#issuecomment-95308175

https://github.com/bokmann/font-awesome-rails/issues?q=is%3Aissue+is%3Aclosed




回答2:


I solved this issue by explicitly declaring a font-family: FontAwesome; rule in my stylesheet because a global * style was overwriting the font-family attribute for the .fa class.



来源:https://stackoverflow.com/questions/37092384/font-awesome-icons-not-showing-using-font-awesome-rails-gem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!