I'm running a rails 3.1 app on Heroku Cedar stack which supports the asset pipeline. Heroku lists 3 ways to compile assets
- Compiling assets locally.
- Compiling assets during slug compilation.
- Compile assets during runtime.
Obviously #3 is bad for performance and Heroku docs also recommend against it. But I'm not sure which is better between #1 and #2.
#1 requires that you run rake assets:precompile
and include your public/assets
folder in git. Your slug will be bigger but I assume the downtime for deploying a site will be lower. But bigger slug size means slower app startup so maybe it's a wash.
#2 will make it take longer to deploy updates because of precompile being done on Heroku side. However, you will have a smaller slug and there's less to manage/remember.
My question is - which option (#1 or #2) is the best for production and why?
So far it looks like option #2 but I want to make sure I'm not overlooking something.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…