[Ruby] [For those who create portfolios] How to use font-awesome-rails

less than 1 minute read

What is ##font-awesome-rails A library that allows you to easily use font Awesome with free web font icons with rails The feature of Font Awesome is that it does not become blurred even when enlarged. You can change the color and size to your liking.

*Since font-awesome-rails does not support the latest version, there are few icons that can be used. We recommend font-awesome-sass for such people.

font-awesome-rails introduction

Gemfile



gem'font-awesome-rails'
$ bundle install

For application.css

*= require font-awesome

For application.scss

@import "font-awesome";

Ready

How to use

Basic

<i class="fa fa-icon name"></i>

Resize

<i class="fas fa-icon name fa-lg"></i>

fa-lg (1.333…times) fa-2x (twice) fa-3x (3x) fa-4x (4x) fa-5x (5 times)

If you want to change to other sizes or colors, you can write it in css.

reference

https://fontawesome.com/v4.7.0/icons/