-
Notifications
You must be signed in to change notification settings - Fork 24
depend_on_asset not respected for template #534
Comments
+1 - Running in to this exact issue...thanks @schneems for the detailed explanation. |
Does |
It doesn't look like Here's the output
Notice that |
Well, I guess this trivial example won't work since the MD5 of evaluating |
Isn't that the point of It took me a few hours of playing with a customer's code to figure out this was the behavior of sprockets, then to repro with a script and open this issue. Btw, doing the reverse works as expected (putting a |
Any idea where this discrepancy in behavior might come from? I've spent more time poking through internals, but i'm going in circles. Any help would be appreciated. I'm willing to submit a patch if I could better understand why this is happening. |
7 day ping. Any ideas? |
@josh regarding your last comment -- In my mind, if we wait on the dependent file to change, then we wouldn't need to specify the dependency explicitly in the first place, as the new digest would be used when the dependent file is re-compiled. Are we missing something here about the intended use case for @schneems were you able to get Confirmed below with your script modified for this use case:
|
@eprothro i've not gotten it to work with any directive |
@schneems I think my boolean logic above miscommunicated. I'm not seeing That's why I mentioned you, it seemed, based on the behavior I'm seeing that the
Then again, it is a Monday, so I may be off base, here. |
@eprothro it looks like cd /tmp
rm -rf sprockets_image_require
rails new sprockets_image_require
cd sprockets_image_require/
echo "FOO" > app/assets/images/foo.svg
mv app/assets/stylesheets/application.css app/assets/stylesheets/application.css.erb
echo "//= depend_on_asset foo.svg" > app/assets/stylesheets/application.css.erb
echo "//= depend_on foo.svg" >> app/assets/stylesheets/application.css.erb
echo "body { background-image: url(<%= asset_path 'foo.svg' %>) } " >> app/assets/stylesheets/application.css.erb
RAILS_ENV=production bundle exec rake assets:precompile
echo "bar" >> app/assets/images/foo.svg
RAILS_ENV=production bundle exec rake assets:precompile At the end I get:
Can you sanity check me here? |
I'm declaring this due to #557 and closing the issue. |
@schneems sorry for the much delayed sanity check. Not sure about sanity at this point, to be honest. I followed your newest script and saw the same behavior that you did. However, it strikes me that the example has changed and is now masking what we're trying to exercise.
Using that So, in my estimation, the issue is still open, as the following (admittedly contrived) example doesn't behave as I would expect.
|
Rails 4.0.3, Ruby 2.1.1: when an asset using the
//= depend_on_asset
directive is depending on a template, it is not re-compiled when the template changes. Below is a run-able script assuming you've got Rails 4.0.3 installed:Is this expected behavior or a known issue? Why doesn't sprockets re-compile my
application.js
file?The text was updated successfully, but these errors were encountered: