简体   繁体   中英

How to load font-awesome icons in rails view?

This could be a dumb question but I am not able to figure it out How to use font-awesome icons in rails view.

I had a static standalone html (added into rails view) and here is the code:

<span class="icon-white">
  <a href="https://twitter.com/xyz">
     <i class="icon icon-twitter"></i>
  </a>
</span>

I had also included

 <%= stylesheet_link_tag "icons.min.css" %> 

in same view. What I am missing here? How can I add into rails view.

Use this

gem "font-awesome-rails"

In your application.css add these lines:

/*
 *= require font-awesome
 */

and If you prefer SCSS, add these lines in your application.css.scss file (don't forget to delete application.css file if you are using SCSS) :

@import "font-awesome";

If you use the Sass indented syntax, add this to your application.css.sass file:

@import font-awesome

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM