2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Rails]Bootstrap3の導入方法

Last updated at Posted at 2020-04-10

開発環境

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

#1.gemを導入

Gemfile
gem 'bootstrap-sass'
gem 'jquery-rails'
ターミナル
$ bundle

#2.「application.css」ファイルをscss形式に変更

ターミナル
$ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss

#3.「application.scss」ファイルを編集

application.scss
// 追記
@import "bootstrap-sprockets";
@import "bootstrap"; 

#3.「application.js」ファイルを編集

application.js
//= require rails-ujs
//= require turbolinks
//= require jquery // 追記
//= require bootstrap-sprockets //追記
//= require_tree .
2
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?