0
0

More than 3 years have passed since last update.

CSS、SCSSファイルの読み込み

Posted at

CSSファイルの読み込み

rails newによってアプリケーションを作成した際にはapplication.cssに

*= require_tree .

の記述がある。この記述によって同じディレクトリにあるcssファイルは読み込まれる。
またこのrequireはアセットパイプラインの仕組みによってファイルを読み込む。
アセットパイプラインはcssファイルやjavascriptファイルを一つにまとめて圧縮し処理速度をあげる仕組み。
アセットパイプラインはsprocketsと言うgemによって実装されている。

SCSSファイルの読み込み

scssファイルはapplication.scssに@importを記述することでscssファイルをインポートする。
この@importはscssのメソッドであり拡張子をscss(application.scss)にしないと使えない。
application.scssからscssファイルをインポートするために使用するメソッドである。

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