I recently faced the scenario where I included a lot of jQuery plugin files for my app, and not using them in the general layout. By stripping out the general javascript file inclusion and specifying this at each individual page I ran into problem. In another general javascript file I had set some functions to be activated, for example this code:
$('.autogrow').autogrow();
The problem with this is that it will generate an error when the autogrow plugin javascript file is not included. The solution is this:
if(typeof $.fn.autogrow == 'function')
$('.autogrow').autogrow();
If will test if the function exists and if so, runs the plugin function.