0

I have searched over the web & stackoverflow about this topic but could not find a comprehensive guide even in heroku's web site.

I have a rails app and when I push the app to heroku here are the steps I am following;

  1. rake assets:clobber
  2. bundle exec rake assets:precompile RAILS_ENV=production
  3. git init
  4. git add .
  5. git commit -m "message"
  6. git push heroku master

Voila!, but then when I make changes in js and/or css files, I start again from number 1 deleting assets then precompile etc as I mentioned. But sometimes I can not see the differences I make on heroku. When I destroy the heroku app and push again there I see.

I am wondering, whether I have to clean Heroku assets as well like rake assets:clobber.

Some people say that when you push to Heroku, it resets asset files automatically but then what is the reason sometimes I can not see the differences.

When committing to git git commit -m "message" do you think this message part must be unique?, maybe when commit with the same message, they create a conflict ?

Thank you

Shalafister's
  • 761
  • 1
  • 7
  • 34

2 Answers2

1

Make sure that you don't use a CDN and try this:

  • bundle exec rake assets:precompile RAILS_ENV=production
  • git add -A
  • git commit -m "message"
  • git push
  • git push heroku master
Yimanei
  • 242
  • 2
  • 8
  • Thank you for your answer. So I dont need to use `rake assets:clobber` everytime I make changes? and what does `git add -A` mean? – Shalafister's May 21 '16 at 19:10
  • 1
    Indeed you don't need `rake assets:clobber` everytime. `git add -A` is to make sure it takes account of your deleted files as well, no matter your Git version, see this answer http://stackoverflow.com/a/26039014/5870640 Glad I helped :) – Yimanei May 23 '16 at 00:26
0

Try deleting public/assets and pushing to Heroku. Heroku should then take care of pre-compiling, etc for you.

When people say Heroku takes care of it for you, they ONLY take care of it if you don't have a public/assets folder.

chintanparikh
  • 1,632
  • 6
  • 22
  • 36