I have a rails 4 app and am trying to use the font awesome icons in it (for social media login links).
I have:
/* application.css.css:
*= require_framework_and_overrides.css.scss
*= require_self
*= require_tree .
*/
/* framework_and_overrides.css.css: */
@import "bootstrap-sprockets";
@import "bootstrap";
@import "font-awesome-sprockets";
@import "font-awesome";
In my gemfile:
gem 'font-awesome-sass', '~> 4.4.0'
I am also using bootstrap sass.
In my view, I try:
<%= link_to content_tag(icon('facebook', class: 'facebookauth')) %>
It renders "<>>" with nothing in between.
I have also tried:
<%= link_to content_tag icon('facebook', class: 'facebookauth') %>
I get the same error.
When I try:
<%= link_to content_tag(fa_icon('facebook', class: 'facebookauth')) %>
<%= link_to content_tag fa_icon('facebook', class: 'facebookauth') %>
I get this error:
undefined method `fa_icon' for
Does anyone know how to use font-awesome in Rails?
A new attempt:
<%= link_to icon('google', id: 'googleauth'), user_omniauth_authorize_path(:google_oauth2) %>
<%= link_to icon('linkedin', id: 'linkedinauth'), user_omniauth_authorize_path(:linkedin) %>
<%= link_to icon('twitter', id: 'twitterauth'), user_omniauth_authorize_path(:twitter) %>
<% end %>
This works fine to make the links, but I'm trying to put styling on the icons.
I have defined a css div called :facebookauth.
When I change the above, to:
<%= link_to icon('facebook', id: 'facebookauth'), user_omniauth_authorize_path(:facebook) %>
Or try:
<%= link_to icon('facebook', class: 'facebookauth'), user_omniauth_authorize_path(:facebook) %>
The links disappear. I want to make the size bigger and use my color styles. How can I put CSS on these links?