rails/sprockets-rails — pull request #126 by matthewd (2014-04-09 07:06:59+00:00)
Title: Instead of complaining, add the dependency automatically

It seems we can easily make #125 Just Work.

Experimentally, I've determined that:
* using `depend_on_asset` in a `.css.scss` file to match an `image-url` is sufficient to make the error go away, but is **not** sufficient to cause the generated CSS to be rebuilt when the image content changes
* with this, no `depend_on_asset` is required, and it Just Works.

Am I just being even more obtuse than usual? Is there some particular arrangement where this doesn't work, and we must insist that the author give us the information?

----

We need to use *both* `depend_on` and `depend_on_asset`, because the latter (bugfully?) considers changes to the referenced asset's dependencies, but not the file itself (making it entirely useless for an image).

I'll follow up on that point with Sprockets, but given that we're currently locked very firmly on a particular version, and that it'll remain a safe no-op if `depend_on_asset` starts to do the job of `depend_on` too, it seems best for us to just call both -- at least for now.

----

Suggestions to avoid calling a Sprockets-protected method are welcome... though again, right now, we know we're breaching Sprockets intended public API. And I suspect that would apply to the current usage of `_dependency_assets`, too.

@rafaelfranca @schneems