Support for RequireJS

Please, support RequireJS. This patch will use RequireJS, if present, to also resolve dependencies. When with have RequireJS there is no need to use the $("head").append() which also seems to mess things up when used.