rails/sprockets-rails — pull request #96 by schneems (2013-10-31 02:12:15+00:00)
Title: [Fix #95] Raise When Dependencies Improperly Used

If a dependency is used in an ERB asset that references another asset, it will not be updated when the reference asset is updated. The fix is to use `//= depend_on` or its cousin `//= depend_on_asset` however this is easy to forget. See #95 for more information.

Currently Rails/Sprockets hides this problem, and only surfaces it when the app is deployed with precompilation to production multiple times. We know that you will have this problem if you are referencing assets from within other assets and not declaring them as dependencies. This PR checks if you've declared a given file as a dependency before including it via `asset_path`. If not a helpful error is raised:

```
Asset depends on 'bootstrap.js' to generate properly but has not declared the dependency
Please add: `//= depend_on_asset "bootstrap.js"` to '/Users/schneems/Documents/projects/codetriage/app/assets/javascripts/application.js.erb'
```

Implementation is quite simple and limited to `helper.rb`, additional code is all around tests.

ATP