I deployed a new version of the Rails 5 application on Heroku, running on the cedar-14 stack. It did not precompile during deployment, so I did heroku run rake assets:precompile manually. However, I see that it includes old assets, while requiring css and js files.
My files are in app/assets , so it is not possible that the directory is not in the compilation path of the resources.
My configuration on application.rb and production.rb :
config.assets.compile = true # I checked the environment variable, it responds to 'enabled', # which would return true for the option. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Which I changed to expire old assets. config.assets.version='1.1'
I tried them, but they did not work:
$ heroku restart$ heroku run rake assets:precompile$ heroku run rake assets:clobber
It is strange that they do not affect the assets on the heroku server, which I checked with $ heroku run ls public/assets . Even after $ rake assets:precompile , although he says this:
WRITING /app/public/assets/application-{VERY_LONG_HASH}.js WRITING /app/public/assets/application-{VERY_LONG_HASH}.js.gz WRITING /app/public/assets/application-{VERY_LONG_HASH}.css WRITING /app/public/assets/application-{VERY_LONG_HASH}.css.gz
when I look at $ heroku run ls public/assets , I still see old assets.
EDIT: I solved it by deleting all local resources in public/assets , recompiling them with $ rake assets:clean && rake assets:precompile and including these resources in my git repository. Here is one problem:
Should the hero be responsible for compiling my assets on the fly? I think that I should not build my assets every time I deploy my application. Thanks.