質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

1回答

307閲覧

Rails5 CSSが404

shortcut_guide

総合スコア4

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2017/08/27 19:19

よくある入門書でRailsで CSSはscssファイルを自動プリコンパイルするという所まで学びました。
ただ、該当のルーティングでcssを呼び出したいのですが、404になってcssが反映されておりません。
入門向けに解決策をいくつかいただけませんか?

本当に入門の入門でapplication.cssすら触っておりません。

/*

  • This is a manifest file that'll be compiled into application.css, which will include all the files
  • listed below.
  • Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
  • vendor/assets/stylesheets directory can be referenced here using a relative path.
  • You're free to add application-wide styles to this file and they'll appear at the bottom of the
  • compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
  • files in this directory. Styles in this file should be added after the last require_* statement.
  • It is generally better to create a new file per style scope.

*= require_self
*= require index
*/

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

*= require indexは見かけないコードです。404というのはindexがありませんということではないでしょうか?(エラーメッセージが記載されていないので想像です)
rails new .をするとapplication.cssは以下のようになってます。なにかの拍子にapplication.cssを触ったのでは?

css

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 */

投稿2017/08/28 15:01

NCC1701

総合スコア1680

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

shortcut_guide

2017/08/28 15:12

誤字失礼しました! 誤字とは関係なく、下記のようなファイルがcontroller生成時点( index.scss) で自動的に生成されると思いますが、404になってしまいます。。。 /assets/index.self-47d608d18e91f136be1de84cebd4d6348a8ef9c5bec8e7a6508ec2534d99cf7a.css?body=1
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問