Hi there, I am going to be implementing jQuery on a very large enterprise level website, and have a few questions with regards to some best-practices for managing scripts.
Where is the best place to include all of the initialization code for plugins? I'd like to keep everything external, but since the site is so large, I can't put all of the dom.ready initilizers inside of one big .js file (like jquery.com). I need to keep things split up for specific sections of the site, and if a plugin is only required for one specific page, do I create a new .js file just to run that specific initializer, or do I bite the bullet and stick it in the <head> of the page itself? I am trying to take advantage of browser- cache as much as possible, which also makes a global .js file unappealing since adding a snippet for one page would make browsers have to dump the cache across the board, even if they never visit that one page. Any suggestions or thoughts would be great, along with some examples of other large sites that handle this problem well. Thanks very much!