以下のURLからBootstrapをダウンロードする。
http://getbootstrap.com/getting-started/#download
ダウンロードしたファイルを解凍し、以下の作業を行う。
bootstrapのcssとjsを配置
「vendor/assets/stylesheets/」に「bootstrap.min.css」を配置
「vendor/assets/javascripts/」に「bootstrap.min.js」を配置
配置したファイルをAsset Pipelineのリストに含める
「app/assets/javascripts/application.js」に「//= require bootstrap.min」を追記する。
以下のような記述となる。
app/assets/javascripts/application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap.min
//= require_tree .
「app/assets/stylesheets/application.css」に「 *= require bootstrap.min」を追記する。
以下のような記述となる。
app/assets/stylesheets/application.css
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*= require bootstrap.min
*/
これまでの作業を行うことで、Bootstrapが適用される。