Introducing Bootstrap and Font-Awesome (Rails)

Introduction method (rails)

Edit Gemfile

gemfile


gem 'bootstrap', '~> 4.5'
gem 'jquery-rails'
gem 'font-awesome-sass', '~> 5.13'

bash


$ bundle

Load it into SCSS

app/assets/stylesheets/application.scss


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

application.js file

app/assets/javascripts/application.js


//= require jquery3
//= require popper
//= require bootstrap-sprockets

Change the extension of application.css.

By default, it is "application.css", but change it to "application.scss". "SCSS" is a CSS extension language that allows you to use bootstrap.

python


 mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss

Description method

erb:xxx.html.erb


<i class="fas fa-Icon name"></i> 

** Icon name search **

Recommended Posts

Introducing Bootstrap and Font-Awesome (Rails)
Introducing Bootstrap to Rails 5
Introducing Bootstrap to Rails !!
Enable jQuery and Bootstrap in Rails 6 (Rails 6)
Rails and FormData
Rails Bootstrap introduced
[Rails] Introducing jquery
[Rails] Introducing devise
Introducing CircleCI to Rails
Introducing Rails6 + Bootswatch / Honoka
[Rails] N + 1 problems and countermeasures
Rails: Difference between resources and resources
Rails Posts and User Linkage
Rails "render method" and "redirect method"
[Rails] Introducing Travis CI and getting stuck in db: create
Rails Tutorial Records and Memorandum # 0
rails path and url methods
Rails is difficult and painful!
Rails is difficult and painful! Ⅱ
[Rails] strftime this and that
Rails web server and application server
[Webpacker] Summary of how to install Bootstrap and jQuery in Rails 6.0
[Rails] Save start time and end time
Introducing full calendar to Rails application
How to deploy Bootstrap on Rails
[Rails] Difference between find and find_by
[Rails] Validation settings and Japanese localization
Rails model and table naming conventions
Remove "assets" and "turbolinks" in "Rails6".
CRUD features and MVC in Rails
[Rails] Differences and usage of each_with_index and each.with_index
Project ruby and rails version upgrade
[Rails 6] Customize Bootstrap in Rails + Bootstrap 5.0.0-alpha environment
Introducing React to Rails with react-rails
Consideration about Rails and Clean Architecture
[rails] Difference between redirect_to and render
Ruby on Rails ✕ Docker ✕ MySQL Introducing Docker and docker-compose to apps under development