0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Sprocketsを 3 -> 4にアップデートしたらmixinの変数が見つからずエラーになった場合の解決方法

Last updated at Posted at 2020-12-09

Rails 5.0.7.2 -> 5.1.7
sprockets 3.7.2 -> 4.0.2

エラー

rails aborted!
Sass::SyntaxError: Undefined variable: "$color-cardinal-red".
/Users/jcoyne85/workspace/sul-dlss/testapp/app/assets/stylesheets/one.scss:1
Tasks: TOP => assets:precompile

sprocketsを3系から4系にアップデートした際、manifest.jsが作成されるが、デフォルトの記載方法だと上記の様にmixinで使っている変数が見つからないとエラーになるので解決方法。

以下がデフォルトの記載

manifest.js

//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css

これを以下に変更

manifest.js

//= link_tree ../images
//= link_directory ../javascripts .js
//= link application.css <- 変更

参考: https://github.com/rails/sprockets/issues/597#issuecomment-489968827

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?