I have a JS function that may occasionally get used on some pages. It is dependent on another JS file (swfObject.js), but I\'d like to avoid having to include this file all
Consider using require.js. This might need some rework of your frontend framework, but it's totally worth it. With require, you could just do the following in your fileUsedOccasionally.js:
define(['swfObject', 'someOtherDependency'], function (swfObject, someOtherDependency) {
// you can now use swfObject as a JS object! you can call it whatever you want
// you'll have to write a swfObject.js to wrap it with require
// but that's trivial
});