LoginSignup
1
0

More than 5 years have passed since last update.

Rails5でBootstrap4を使おうとしたらassets precompileで未定義エラー

Last updated at Posted at 2019-04-13

はじめに

bootstrap-sassでエラーメモ
こちらの方とエラー内容、解決方法としては同じだが、以下のbootstrap-rubygemでも発生したので、書き留めておく。
bootstrap-rubygem

エラー内容

先述のgemのREADME->Installation->a.Ruby on Railsに従って、bootstrapを使う設定を行い、アプリを起動したところ以下のエラーが発生した。

Undefined variable: "$alert-padding". while precompile assets

解決方法

以下のようにワイルドカードでコンパイル後のcssを取り込もうとしていた。

assets.rb
Rails.application.config.assets.precompile += %w( *.js *.css)

これがまずいらしく、以下のように取り込むcssを指定して設定する必要がある

assets.rb
Rails.application.config.assets.precompile += %w( *.js *application.css)
1
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
1
0