0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Rails】application.cssについて

Last updated at Posted at 2025-04-20

記事概要

Ruby on Railsのマニフェストファイルについて、まとめる

前提

  • Ruby on Railsでアプリケーションを作成している

基本情報

ファイルパス

app/assets/stylesheets/application.css

記載方法

*=に続けて他のCSSファイルなどを指定すると、複数のCSSファイルをまとめて読み込むことが可能だが、編集不要

処理概要

アプリケーション全体に適用するCSSを指定できる

まとめ

require_tree

引数として与えられたディレクトリ以下のCSSファイルを、アルファベット順にすべて読み込む機能

require_tree .の記述によって、app/assets/stylesheetsディレクトリにある全ての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, if configured) 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
 * 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_tree .
 *= require_self
 */

Image from Gyazo

Ruby on Railsまとめ

ビュー

application.html.erb

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?