Railsにて自分で書いたCSSを使う
開発環境はWindows7 Professional(32bit) + Ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]+ Rails 5.1.6。
1.railsで新しくアプリを作る
2.app/assets/stylesheets/application.cssを開いて、以下の内容を追加する。
.test{ color:red; font-size:30px; }
3.作ったアプリのルートディレクトリをカレントディレクトリにして、以下のコマンドを入力する
rails g controller root index
4.config/routes.rbを開いて、以下のコードを追加する
root to: 'root#index'
5.app/views/root/index.html.erbファイルを開いて、以下の内容を追加する
<div class="test"> いいね </div>
6.以下のコマンドを入力してサーバーを起動して、http://localhost:3000/へアクセスする
rails s
実行結果