[Rails] How to install Font Awesome

Development environment

・ Ruby: 2.5.7 Rails: 5.2.4 ・ Vagrant: 2.2.7 -VirtualBox: 6.1 ・ OS: macOS Catalina

Account creation

  1. Access the link below. Font Awesome Start screen

  2. Enter your email address and click "Send Kit Code". 1.png

  3. When you receive a confirmation email, access the link "Click to Confirm Your Email Address + Set Things Up".

  4. The following screen will be displayed. Enter the password and click "Set Password & Continue". image.png

  5. The screen will change to the profile information input screen, but since there is no need to make any settings now, Click "All set. Let's Go!" Without entering anything. image.png

  6. The following screen will be displayed. Click "Copy Kit Code" to copy the code. image.png

Rails side operation

1. Edit "application.html.slim"

Paste the code you copied earlier and convert it to Slim format.

slim:application.html.slim


doctype html
html
  head
    title
      |Font Awesome test
    = csrf_meta_tags
    = csp_meta_tag
    = stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload'
    = javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
    /Postscript
    script src='https://kit.fontawesome.com/c51513dd6c.js' crossorigin='anonymous'

2. Show icon

① Access the following site and click the icon you want to use. Font Awesome Icon List

(2) The screen will change to the one shown below, so copy the class name. image.png

③ If you write in HTML as shown below, the icon will be displayed.

~html.slim


i.far.fa-heart

Recommended Posts

[Rails] How to install Font Awesome
[Rails] How to install Font Awesome
[Rails] How to install devise
[Rails] How to install simple_calendar
[Rails] How to install reCAPTCHA
[Rails] How to install ImageMagick (RMajick)
How to install Swiper in Rails
How to insert icons using Font awesome
How to write Rails
How to uninstall Rails
How to install docker-machine
How to install MySQL
How to install ngrok
[Ruby on Rails] How to install Bootstrap in Rails
[rails] How to post images
[Rails] How to use enum
[Rails] How to use enum
How to read rails routes
How to install Boots Faces
How to terminate rails server
How to write Rails validation
How to write Rails seed
[Rails] How to use validation
[Rails] How to disable turbolinks
[Rails] How to use authenticate_user!
[Rails] How to use "kaminari"
[Rails] How to implement scraping
[Rails] How to make seed
How to write Rails routing
How to install JDK8-10 (Mac)
[Rails] How to use Scope
[Rails] How to install a decorator using gem draper
[Rails] How to use gem "devise"
How to deploy jQuery on Rails
Rails new fails to install mysql
[Rails] How to use devise (Note)
[Rails] How to use flash messages
[rails] How to display db information
How to install JMeter for Mac
[Rails] How to write in Japanese
[Rails] How to prevent screen transition
How to install ImageMagick on Windows 10
How to install ruby through rbenv
[How to install Spring Data Jpa]
How to deploy Bootstrap on Rails
[Rails] How to speed up docker-compose
Super rough! How to install Dagger2
[Rails] How to add new pages
How to install Bootstrap in Ruby
How to use Font Awesome icon for ul and li
How to install MariaDB 10.4 on CentOS 8
Rails on Tiles (how to write)
[Rails] How to write exception handling?
[Rails] How to use Active Storage
How to install WildFly on Ubuntu 18.04
How to introduce jQuery in Rails 6
[Rails] How to implement star rating
How to return Rails API mode to Rails
How to get along with Rails
Super easy in 2 steps! How to install devise! !! (rails 5 version)
[Introduction to Rails] How to use render