LoginSignup
2
4

More than 1 year has passed since last update.

簡単!Rails6にBootStrap5を導入する

Last updated at Posted at 2021-01-29

はじめに

本記事は2021年9月時点の最新環境である、Rails6 に BootStrap5を導入する方法を紹介しています。
また、BootStrapに関してはsassで編集できるようにしています。

gemfile

まずは、gemfileに以下の行を追加しましょう

gemfile
gem 'bootstrap', '~> 5.0.0.alpha1'
gem 'jquery-rails'

ターミナル(コマンドプロンプト)にて

ターミナル
bundle install

を実行しましょう。

application.cssを変更

app/stylesheets/の中にある
application.cssapplication.scssにファイルをリネームしましょう。


それができたら、application.scssに以下の文を追加して下さい。

app/stylesheets/application.scss
@import "bootstrap-sprockets";
@import "bootstrap";

以上でBootstrapの導入が完了しました。

2
4
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
2
4