masalibの日記

システム開発、運用と猫の写真ブログです

Railsでのtwitter bootstrapをやってみた

http://ppworks.hatenablog.jp/entry/2012/02/19/033644
f:id:masalib:20120807141342j:plain
上記のサイトを参考にしてつくってみました


本当に簡単です

#GemFileの修正
vi Gemfile
gem "twitter-bootstrap-rails"

rails g bootstrap:install
CSSのインストール

app/views/layouts/application.html.erbにひな形のレイアウトを作成。
スマートフォン対応で可変レイアウトにしました
rails g bootstrap:layout application fluid

参考にしたURLとかっこよく出力されました(・∀・)

f:id:masalib:20120807140635j:plain

(色はオレンジにしました)


ちなみに本番UPするときには

    <!-- For third-generation iPad with high-resolution Retina display: -->
    <!-- Size should be 144 x 144 pixels -->
    <%= favicon_link_tag 'images/apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-pre

    <!-- For iPhone with high-resolution Retina display: -->
    <!-- Size should be 114 x 114 pixels -->
    <%= favicon_link_tag 'images/apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-pre

    <!-- For first- and second-generation iPad: -->
    <!-- Size should be 72 x 72 pixels -->
    <%= favicon_link_tag 'images/apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-preco

    <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
    <!-- Size should be 57 x 57 pixels -->
    <%= favicon_link_tag 'images/apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed

    <!-- For all other devices -->
    <!-- Size should be 32 x 32 pixels -->
    <%= favicon_link_tag 'images/favicon.ico', :rel => 'shortcut icon' %>

上記の「images/」という部分に注意が必要

普通に/app/assets/imagesおいても
テンプレートエラーになってしまう

テンプレートのimages/を削除するのか
/app/assets/imagesのしたにimagesを作らなければならない

そこは考慮してほしかったな~

改訂新版 基礎Ruby on Rails (IMPRESS KISO SERIES)

改訂新版 基礎Ruby on Rails (IMPRESS KISO SERIES)