Assets precompilation uses obsolete older assets #3119

Closed
jurglic opened this Issue Sep 23, 2011 · 2 comments

3 participants

@jurglic

When I run assets:precompile, asset helpers generate references to older assets versions. It happens only when manifest.yml already exists and lists older asset.

I'm using all application defaults that come with rails-3-1-stable branch. Meaning compile is off, digest is on in production environment. You can find the whole app code here.

Issue is really easy to replicate:

  • 1) I have image "rails.png". I'm using it via asset helper in my application.css.erb. When I run "rake assets:clean" and afterwards "rake assets:precompile", this is my manifest.yml:
rails.png: rails-baabe95f92a24261e266814d58a17958.png
application.css: application-479fcab7624cd5d7a67eebb0aca9fa45.css
  • 2) I change rails.png with new image and run "rake assets:precompile". My new manifest.yml - notice application.css digest stays the same, altough it should reference the new version of rails.png image:
rails.png: rails-bd9ad5a560b5a3a7be0808c5cd76a798.png
application.css: application-479fcab7624cd5d7a67eebb0aca9fa45.css
  • 3) I run "rake assets:precompile" again. Now the generated files are correct and so is the manifest.yml. Application.css is correctly referencing new rails.png image.
rails.png: rails-bd9ad5a560b5a3a7be0808c5cd76a798.png
application.css: application-9aace46009e71099ec1b21003d2844c5.css

The workarounds seems to be to either run assets:precompile again, or simply delete manifest file before running assets:precompile task.

@guilleiguaran
Ruby on Rails member

can you test with the clear-digests-on-precompile of my Rails fork?

https://github.com/guilleiguaran/rails/tree/clear-digests-on-precompile

@guilleiguaran guilleiguaran added a commit to guilleiguaran/rails that referenced this issue Sep 26, 2011
@guilleiguaran guilleiguaran Avoid use of existing precompiled assets during rake assets:precompil…
…e run. Closes #3119
b605bd5
@spastorino
Ruby on Rails member

Pushed

@spastorino spastorino closed this Sep 26, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment