Hello all,
I'm very curious how your Rails apps include javascript. For example:
- do you package all your js code into a single file and serve it for all requests?
- do you conditionally load certain js depending on controller/action?
- what tools or techniques do you use, ie: asset_packager, yui compressor, sprockets, BigPipe inspired implementation?
A bit of background: I work on a massive Rails app that is very JS heavy. Currently, all js is minified and served from a single file. This makes things very convenient as all frameworks and widgets are available everywhere. I'm beginning to question this approach is it seems a bit crazy to make all users pay the price for some js that they may never see. Littering the code with script includes seems crappy and difficult as large portions of the site deliver content via ajax.
Anyone have any advice to share?
Thanks much!