LoginSignup
6
6

More than 5 years have passed since last update.

【Ruby On Rails】Twitter BootStrapの導入

Posted at

昨日Ruby On Railsを始めたばかりの初心者ゆえ、間違ってたらごめんなさい。

動作環境

OS:centOs6
ruby 2.2.2p95
Rails 4.2.3

Gemfileの編集

Gemfile
gem 'therubyracer' # javascript runtime。lessをコンパイルするために必要
gem 'less-rails' # Railsでlessを使えるようにする。Bootstrapがlessで書かれているため
gem 'twitter-bootstrap-rails' # Bootstrapの本体

bundleインストール

bundle install --path ./vendor/bundle/

bundle installしてGemfileに書かれた情報を元に必要なgemパッケージをインストールする

application.jsの修正

//= require twitter/bootstrap`

application.js
//= require twitter/bootstrap`

application.js
//= require bootstrap`

require twitter/bootstrapのパスを修正。
bundle installするとapplication.jsが更新されますが、どうやらrequireのパスが違うっぽい?
requireは
/app/assets/javascripts/***.js.coffee
の.js,.coffeeを除いたファイル名で読み込めます。

参考

RailsにTwitter Bootstrapの導入と簡易な使い方
http://ruby-rails.hatenadiary.com/entry/20140801/1406818800#twitter-bootstrap-install1

6
6
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
6
6