Introduction and usage explanation of Font Awesome

This time, I will explain how to install Font Awesome and how to display it.

Introducing Font Awesome

  1. Add the following description to Gemfile

gem "font-awesome-sass"
$ bundle install
  1. Describe the following in application.scss.

@import "font-awesome-sprockets";
@import "font-awesome";

This completes the installation.

View in view

I will use the icon helper method. The example of how to use it is like this.

icon('Prefix name', 'Icon name')

It looks like this when actually used.

= icon('fab', 'facebook-square') #Example

Reference material

Check the following sites for prefix names and icon names and use them! https://fontawesome.com/

Recommended Posts

Introduction and usage explanation of Font Awesome
Introduction and basic usage of Simple Calendar gem
[Rails] Differences and usage of each_with_index and each.with_index
From introduction to usage of byebug
Explanation of Ruby Time and Date objects
Basic usage of enums and code examples
Introduction of Docker Hub and commands Self-learning ①
[Ruby] Classification and usage of loops in Ruby
Introduction and precautions of gem Friendly Id
Introduction of pay.jp
[Rails 6] Specific method of embedding Font Awesome in link_to [Copy and paste OK]
Learn the rudimentary mechanism and usage of Gradle 4.4
Introduction and introduction of management screen generation gem Administrate
Introduction of Docker --Part 1--
[Rails] Introduction of PAY.JP
SystemSpec introduction and writing
Introduction of user authentication
[For beginners] Explanation of classes, instances, and statics in Java
How to use Font Awesome icon for ul and li
Introduction purpose of ActiveHash and simple flow to application implementation