Created
January 22, 2015 12:55
-
-
Save eneveu/1efba4911380487050f1 to your computer and use it in GitHub Desktop.
jQuery + curl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bootstrap.js:8 Uncaught Error: Bootstrap's JavaScript requires jQuery | |
slidebars.js:346 Uncaught ReferenceError: jQuery is not defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global curl*/ | |
var baseUrl; // pre-existing globals | |
(function () { | |
var cjsConfig = { | |
loader: 'curl/loader/cjsm11' | |
}; | |
curl.config({ | |
baseUrl: baseUrl || '', | |
packages: { | |
main: { location: 'js', config: cjsConfig, main: 'main' }, | |
curl: { location: 'lib/curl/src/curl/' }, | |
when: { location: 'lib/when', main: 'when' }, | |
most: { location: 'lib/most', main: 'most', config: cjsConfig }, | |
poly: { location: 'lib/poly' } | |
}, | |
paths: { | |
jquery: 'lib/jquery/dist/jquery', | |
bootstrap: { | |
location: 'lib/bootstrap/dist/js/bootstrap', | |
config: { | |
loader: 'curl/loader/legacy', | |
requires: [ 'jquery' ], | |
// Bootstrap doesn't 'export' a proper global variablen only a bunch of jquery plugins, but you can use | |
// any of those plugins as an export value | |
// http://stackoverflow.com/questions/13377373/shim-twitter-bootstrap-for-requirejs/13556882#13556882 | |
exports: '$.fn.tooltip' | |
} | |
}, | |
rowlink: { | |
location: 'js/rowlink', | |
config: { | |
loader: 'curl/loader/legacy', | |
requires: [ 'jquery' ], | |
exports: '$.fn.rowlink' | |
} | |
}, | |
slidebars: { | |
location: 'lib/Slidebars/distribution/0.10.2/slidebars', | |
config: { | |
loader: 'curl/loader/legacy', | |
requires: [ 'jquery' ], | |
exports: '$.slidebars' | |
} | |
} | |
}, | |
preloads: ['poly/es5'] | |
}); | |
curl(['main']).then(start, fail); | |
function start(main) { | |
} | |
function fail(ex) { | |
// TODO: show a meaningful error to the user. | |
throw ex; | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment