LoginSignup
0
0

More than 3 years have passed since last update.

BootstrapとFont-Awesome導入(Rails)

Last updated at Posted at 2020-12-20

導入方法(rails)

Gemfileを編集する

gemfile
gem 'bootstrap', '~> 4.5'
gem 'jquery-rails'
gem 'font-awesome-sass', '~> 5.13'
bash
$ bundle

SCSSに読み込ませる

app/assets/stylesheets/application.scss
@import "bootstrap";
@import 'font-awesome-sprockets';
@import 'font-awesome';

application.jsファイル

app/assets/javascripts/application.js
//= require jquery3
//= require popper
//= require bootstrap-sprockets

application.cssの拡張子を変更する。

デフォルトでは、application.css」だが、「application.scss」に変更する。
「SCSS」はCSSの拡張言語で、bootstrapを使用できるようになる。

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

記述方法

xxx.html.erb
<i class="fas fa-アイコン名"></i> 

アイコン名検索

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0