Skip to content

Instantly share code, notes, and snippets.

@eneveu
Created January 22, 2015 12:55
Show Gist options
  • Save eneveu/1efba4911380487050f1 to your computer and use it in GitHub Desktop.
Save eneveu/1efba4911380487050f1 to your computer and use it in GitHub Desktop.
jQuery + curl.js
bootstrap.js:8 Uncaught Error: Bootstrap's JavaScript requires jQuery
slidebars.js:346 Uncaught ReferenceError: jQuery is not defined
/*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