sprockets-rails icon indicating copy to clipboard operation
sprockets-rails copied to clipboard

Rake task for completely clear assets cache

Open ypresto opened this issue 8 years ago • 2 comments

Clearing tmp/cache/assets is necesasry to regenerate assets correctly, but rails assets:clean or rails assets:clobber does not clear tmp/cache/assets. I spent hours to solve cache issue after changing config.assets.prefix...

While it can be done with tmp:cache:clear, I think it'd better to have own task to clear that dir to avoid confusion.

Possible solutions:

  • Add assets:clear-cache task to run rm -rf tmp/cache/assets.
  • Add assets:clean-all task to run clobber and rm -rf tmp/cache/assets.
  • Add reference to tmp/cache/assets or tmp:cache:clear to the document.

Related issues

It was previously part of assets:clean: https://github.com/rails/rails/pull/2448

There are similar reports on other (wrong) repos: https://github.com/twbs/bootstrap-sass/issues/550 https://github.com/rails/sass-rails/issues/118

Document for clearing cache was improved in this PR: https://github.com/rails/sprockets-rails/pull/335

ypresto avatar Feb 16 '17 14:02 ypresto

If I understand correctly, this issue might be resolved by rails/sprockets#257, which changes the assets:clobber task to also clear the Sprockets cache store (tmp/cache/assets) in addition to all precompiled assets.

Could you try this task using master version of sprockets (no release has been published yet since this PR has been merged) and see if it fixes your issue?

wjordan avatar Aug 25 '17 20:08 wjordan

Clearing tmp/cache/assets is necesasry to regenerate assets correctly, but rails assets:clean or rails assets:clobber does not clear tmp/cache/assets. I spent hours to solve cache issue after changing config.assets.prefix...

While it can be done with tmp:cache:clear, I think it'd better to have own task to clear that dir to avoid confusion.

Possible solutions:

  • Add assets:clear-cache task to run rm -rf tmp/cache/assets.
  • Add assets:clean-all task to run clobber and rm -rf tmp/cache/assets.
  • Add reference to tmp/cache/assets or tmp:cache:clear to the document.

Related issues

It was previously part of assets:clean: rails/rails#2448

There are similar reports on other (wrong) repos: twbs/bootstrap-sass#550 rails/sass-rails#118

Document for clearing cache was improved in this PR: #335

@taylorjalpha

TaylorJalpha avatar Aug 13 '19 05:08 TaylorJalpha