9
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Rails] bootstrap・reactの設定をする.

Last updated at Posted at 2016-06-12

#bootstrapの設定
まずはGemをインストール,

Gemfile
gem 'bootstrap-sass'

gemをインストール

Terminal
$ bundle install

app/assets/stylesheets/application.css を application.css.scss に変更`

File
app/assets/stylesheets/application.css.scss

bootstrapを使うために "bootstrap" と, "bootstrap-sprockets" をimportする.
(app/assets/stylesheets/application.css.scss)

application.css.scss
@import "bootstrap-sprockets";
@import "bootstrap";

bootstrapのjsのコンポーネントも使う場合は,下記を追加.
(app/asets/javascripts/application.js)

application.css.scss
//= require bootstrap-sprockets

Webサーバを再起動

Terminal
$ rails s

#React.jsの設定
ますは,Gemをインストール

Gemfile
gem 'react-rails'

gemをインストール

Terminal
$ bundle install

reactを使えるようにしてくれる,generatorをたたく.

Terminal
$ rails g react:install

Componentを生成する際もgeneratorが便利
今回は,Testというコンポーネントを作成

Terminal
$ ralis g react:component Test

#設定ができたら
下記のを参考にして手を動かしてみるのがいいと思います.

#参照元
reactを使ってtask管理アプリを作ってみた
react-railsを使ってReactのTutorialをやってみる
twbs/bootstrap-sass

9
15
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
9
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?