わからないこと stylesheetsフォルダにあるcssファイル全てがviewに反映してくれないこと.
私がやったこと rails 5.2.1 new filebook -d mysqlをした。その後途中からcssが反映しなかったがそのままにしてしてバックエンドのプログラミングをした。、いざcssをやろうとしたら全く反映されていないので困っています。
cssの書き方については間違っていないと思います。もしかしたら何かコードを消してしまった可能性が高いです。
stylesheetsフォルダ
answers.scss
application.scss
infomations.scss
comments.scss
favorites.scss
users.css
今のところcssが全く動かないことにより、自分がこの2つのファイルが怪しいと思いまして、その中かでコードを削除したと自分は考えています。
appliction.html.erb
1<!DOCTYPE html> 2<html> 3 <head> 4 <title>Filebook</title> 5 <%= csrf_meta_tags %> 6 <%= csp_meta_tag %> 7 8 <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 9 <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 10 </head> 11 12 <body> 13 <%= yield %> 14 </body> 15</html> 16 17 18
application.scss
1/* 2 * This is a manifest file that'll be compiled into application.css, which will include all the files 3 * listed below. 4 * 5 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 6 * vendor/assets/stylesheets directory can be referenced here using a relative path. 7 * 8 * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 * files in this directory. Styles in this file should be added after the last require_* statement. 11 * It is generally better to create a new file per style scope. 12 * 13 *= require_tree . 14 *= require_self 15 */ 16 17 18
今私も解いています。 力を貸してください!!!
「cssファイル全てがviewに反映してくれない」というのは、「1ファイルも反映されない」のでしょうか、それとも「反映されるファイルとされないファイルが存在する」状況でしょうか?
全てのファイルが反映されていません...
だから、どっちですか?その文言だと全否定にも部分否定にも取れます。
1ファイルも反映されていない状態です。
railsタグをつけることをお勧めします。
ただ今railsタグについて調べましたが、railsでタグ機能を作るという記事をたくさんみましたが、railsでタグ機能を作るで直るとうことでしょうか?
いえ、そうことではなく。
この質問にはCSSタグが付いていますが、問題はrailsにあるように感じられました。
しかし、私はCSSを得意としていますが、railsは全く素人なので解決方法が分かりません。
ですので、質問のタグにrailsを追加して、railsを得意としている回答者に見てもらった方が、解決につながるのではないか、ということです。
なるほど助かります。!!!