LoginSignup
2

More than 5 years have passed since last update.

RailsのBootstrap覚え書き

Posted at

はじめに

いっつもやりかた忘れちゃうので書きます。書いて覚えます。
RailsにBootstrapを適用する、です。

実装

まずはGemfileに書いてinstallします。

Gemfile
# bootstrap
gem 'bootstrap', '~> 4.1.3'
gem 'jquery-rails'
bash
$ bundle install

次に app/assets/stylesheets/ 下にある、application.css ファイルを application.scss にリネーム(拡張子変更)

あとはscssファイルとjsファイルに次を追記しておしまい!

app/assets/stylesheets/application.scss
@import bootstrap
app/assets/javascripts/application.js
//= require jquery3
//= require popper
//= require bootstrap-sprockets

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