4

When I do: rake assets:precompile RAILS_ENV=production I get for example the following files in my public/assets folder:

  • application-7af6c31514bcdd4cce3c96892af4487f.js
  • application-7af6c31514bcdd4cce3c96892af4487f.js.gz
  • application.js
  • application.js.gz

The last 2 are a problem because it causes the compiled version to get served in development and I don't understand why they are being generated.

I have the following line in my production.rb:

config.assets.digest = true
pguardiario
  • 53,827
  • 19
  • 119
  • 159
  • I think I'm experiencing the same issue. In my development environment javascript got broken after assets:precompile, but in production it's working fine. Still don't know how to solve it and I already deleted all files in public folder. – Ismael Abreu Jun 13 '12 at 01:26

2 Answers2

6

To stop the creation of the non-hashed filenames in public use:

rake assets:precompile:primary RAILS_ENV=production
Damon Mannion
  • 324
  • 2
  • 3
2

This is the normal behaviour of the asset compiler, the non-digest files are generated mainly for use in error pages and the like (where you don't have access to the MD5 hash) and there is currently no way to turn them off. Also, this question is virtually identical to this one: Rails compiles assets both with and without md5 hash, why?

Community
  • 1
  • 1
Ola Tuvesson
  • 5,062
  • 2
  • 28
  • 37
  • I read that post and it seems that @NudeCanalTroll found a way to turn it off but doesn't know how he did it and wishes he didn't. *sigh* – pguardiario Jun 13 '12 at 06:24
  • I just delete my compiled assets and don't regenerate them until I need to test in production mode and/or prepare for deployment. It seems to me the problem is not so much the existence of these files but that Rails prefers them over the originals in app/assets when running in development mode. – Ola Tuvesson Jun 13 '12 at 06:38