Declaring script dependencies - marcbaechinger/craft.js GitHub Wiki
Declare dependencies of a script with a //= require
processing instruction at the top of a JavaScript file:
//= require "../../model/collection"
//= require "../../widget"
// use constructor exposed by dependencies
var coll = new model.Collection();
...
A require statement must stand on it's own line. All statements are hoisted to the top of the file.
If declared as above craft.js will prepend the current file with the contents of the depency file. craft.js resolves all dependencies declared in a file recursively and takes care that a script is only inserted once when referneced by more than one script.