Skip to content

Instantly share code, notes, and snippets.

@webpro
Created September 4, 2013 12:29
Show Gist options
  • Save webpro/b23b73522a5cb7ff3b85 to your computer and use it in GitHub Desktop.
Save webpro/b23b73522a5cb7ff3b85 to your computer and use it in GitHub Desktop.
Boot with curl
(function() {
var debug = false,
legacy = false,
preloads = [];
var scripts = document.getElementsByTagName('script'),
script = scripts[scripts.length - 1],
src = script.src,
srcParts = src.split('/'),
srcFile = srcParts.pop(),
basePath = srcParts.length ? srcParts.join('/') + '/' : './';
if(script.attributes.debug || window.location.search.indexOf('debug') > -1) {
debug = true;
preloads.push('core/debug');
}
// See which shims we need
if(typeof Array.prototype.map !== 'function' || typeof Function.prototype.bind !== 'function' || typeof Object.preventExtensions !== 'function') {
legacy = true;
preloads.push('core/legacy');
}
curl({
preloads: preloads,
paths: {
'core/bootstrap': basePath + 'bootstrap',
'core/debug': basePath + 'debug',
'core/legacy': basePath + 'legacy',
'core/util': basePath + 'util' + (legacy ? '.legacy' : ''),
'core_util': basePath + 'util'
}
});
define('core/core', ['core/bootstrap'], function(bootstrap) {
return {
version: 'dev',
debug: debug,
legacy: legacy,
boot: bootstrap
}
});
define('core', ['core/core'], function(core) {
return core;
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment