5
4

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 5 years have passed since last update.

Rails で javascript が2回読み込まれる

Posted at

config.asset.debug=true にするとデバッグ用に個々に読み込んでいる javascript ファイルとプリコンパイルされていた application.js を読み込んでしまうため重複してしまう。

以下のように config.serve_static_assets = false を設定し、application.js の中身を消去(必要ないかも)すると重複が避けられる。

config/environments/development.rb
  # Do not compress assets
  config.assets.compress = false

  # Expands the lines which load the assets
  config.assets.debug = true

  # 静的ファイルを保持しないようにする
  config.serve_static_assets = false
5
4
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
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?