[Rails] Setup Font Awesome using Yarn

February 28, 2021


Get vector icons and social logos on your website with Font Awesome, the web’s most popular icon set and toolkit.

Details from fontawesome website.

With Boring Generator

Boring Generator installation guide.

> rails generate boring:font_awesome:yarn:install

Without Boring Generator

1. Add Font Awesome

> yarn add @fortawesome/fontawesome-free

2. Import Font Awesome stylesheets

# app/javascript/stylesheets/application.scss

@import '@fortawesome/fontawesome-free';

3. Import Font Awesome JavaScript

# app/javascript/packs/application.js

import "@fortawesome/fontawesome-free/js/all";

And you are all setup to use Font Awesome icons. You can also install fontawesome using RubyGem.

Happy Coding!!!