LoginSignup
11
11

More than 5 years have passed since last update.

DeviseにBootstrap3のスタイルを適用させるgem「devise-bootstrap-views」

Last updated at Posted at 2017-04-13

概要

  • railsにユーザー認証機能をつけるgemであるdeviseにbootstrapのデザインを適用させる

こんな感じのフォーム画面が...
スクリーンショット 2017-04-13 12.49.48.png

こんな感じになります
スクリーンショット 2017-04-13 13.00.58.png

環境

  • Rails 5.0.2

  • ruby ruby 2.2.6p396 (2016-11-15 revision 56800) [x86_64-darwin15]

インストール

gemが公開されているGitHubのURL
https://github.com/hisea/devise-bootstrap-views

Gemfileにgemを追加

Gemfile
# Deviseはすでに導入されているとします。
gem 'devise-bootstrap-views'

インストールします

$ bundle install --path vendor/bundle

deviseにbootstrapのスタイルを適用

以下の文言を追加

application.css
# SASS
*= require devise_bootstrap_views

# LESS
*= require devise_bootstrap_views_less

boostrapに対応したフォームのテンプレートを作成

$ rails g devise:views:bootstrap_templates

サーバーを再起動して確認。
これで簡単にBootstrap3に対応したフォームを作ることができました。

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