■環境
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
Rails 6.0.3.5
■状況
①viewからCSSを読み込むため、headタグに以下を追記
<%= stylesheet_link_tag 'index', media: 'all', 'data-turbolinks-track': 'reload' %>
②app/assets/stylesheets/ディレクトリにindex.cssファイルを手動で生成
③ビューファイルを開くと「Sprockets::Rails::Helper::AssetNotPrecompiled in ***」というエラーが出る。
■対処法
①config/initializers/assets.rbファイルに以下を追記
Rails.application.config.assets.precompile += %w( index.css )
②サーバを再起動(ctrl+C → rails s)
★2021/03/22ここまで