In Ruby on Rails, is it possible to concatenate multiple Javascript files at runtime?
I am building a Facebook app that relies heavily on Javascript. I have some Javascript files for this. Since in Facebook development, the page is processed through a tunnel, excess latency is added when multiple javascript files are requested. Is it possible to combine the contents of multiple javascript files at runtime? Having multiple files makes development easier and therefore I avoid combining it at design time.
source to share
Better than combining at runtime, have a look at Frizione . It is an environment that will allow you to concatenate javascript files during deployment and compress them. This way you can save everyone around you. It also generates document generation and JSLint validation, but that's just an added bonus.
source to share
I have used the asset_packager gem to do this in my applications.
It will combine and minify your javascript (and CSS) files for production and add some view helpers that make it very easy to use. There's a rake command that you run to generate zipped files if the originals have changed.
source to share