LoginSignup
1
2

More than 5 years have passed since last update.

Rails4.*でbootswatchを使用する

Last updated at Posted at 2016-10-03

Bootswatch?

インストール

Gemfileに次のように追記

Gemfile
# コレ以外のbootstarap系のgemは入れないでOK
gem 'twitter-bootswatch-rails', '~> 3.3.4'
gem 'twitter-bootswatch-rails-helpers'

次にbundle installを実行してgemを入れる
gemが入ったら、レイアウトを選んで次のコマンドを実行。これで好みのレイアウトをインストールできる。

# simplexの部分はレイアウト名です
$ rails g bootswatch:install simplex
$ rails g bootswatch:import simplex
$ rails g bootswatch:layout simplex

インストールできたら、application.cssに以下のように追記

/*
 *= require_self
 *= require_tree .
 *= require [theme_name]/loader
 *= require [theme_name]/bootswatch
*/

また、application.jsに以下のように追記

//= require jquery
//= require jquery_ujs
//= require [theme_name]/loader
//= require [theme_name]/bootswatch

これで、bootswatchのレイアウトが使えるようになる!

1
2
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
1
2