When I precompile my assets for a rails 3.1 app with rake assets:precompile
it spits out an old cached version if nothing changes in the asset files. I can tell because my erb is making use of a constant that I was trying to change elsewhere in my app. One work around is to alter one of the css files (eg by adding a space etc) before re-precompiling but this is a pain and I would like to try and disable this caching if it is possible. Any ideas???
Asked
Active
Viewed 486 times
1

Matthew
- 12,892
- 6
- 42
- 45
-
1You could add a `rake assets:clean` to be sure, but that is only a workaround. – mliebelt Oct 13 '11 at 23:40
-
Thanks @mliebelt, I will give it a try. It is certainly better than adding a new line to my application.css.scss – Matthew Oct 14 '11 at 04:38
1 Answers
2
This is the expected behavior of the pipeline - the ERB is evaluated only once when you precompile. The value at compile time is the value you get in the file.
The caching is based on the checking the timestamp of the files. You could run Sprockets in production without precompiling (this is called live compiling), but you cannot turn off the caching because the performance would be dreadful - every single request would require Sprockets to recompile all the files.
Sorry :-(

Richard Hulse
- 10,383
- 2
- 33
- 37