I have a Rails 3.1 app and for some reason when I change CSS, the changes don't show up. I did bundle exec rake assets:precompile
and it helped once, but now I am stuck with the old CSS no matter what.
In case any future Googlers find this thread: I had the same problem in the test environment of a Rails 4.2.8 application. None of the above solutions worked. Setting config.serve_static_files = false
in config/environments/test.rb
solved it.
Bear in mind that this is a temporary fix as it causes all files in the public
folder to no longer be served (including 404.html, favicon.ico, robots.txt, etc).
As your assets are now precompiled you need to clean them with the following
bundle exec RAILS_ENV=development rake rails_group=assets assets:clean
For my production environment I had to combine a few of the above steps to get my assets recompiled.
First I had to do:
rake assets:clean
Making sure I was in the right environment
Then I needed to delete the public/assets
directory that the precompile creates (or just the file that you need to fix, application-<hash>.css
for example)
Then finally re-run
rake assets:precompile
And restart my apache server (I use passenger with apache, not tested with nginx)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With