Skip to content

Instantly share code, notes, and snippets.

@nielk
Created March 18, 2014 08:19
Show Gist options
  • Save nielk/9615688 to your computer and use it in GitHub Desktop.
Save nielk/9615688 to your computer and use it in GitHub Desktop.
requirejs simple example
require.config({
paths: {
'jQuery': '../vendors/jquery/jquery-1.11.0.min',
'carousel': '../vendors/bootstrap/js/carousel',
'transition': '../vendors/bootstrap/js/transition',
'swipe': '../vendors/jquery-swipe/jquery.touchSwipe.min',
'select' : '../vendors/select-0.5.0/select.min'
},
shim: {
'jQuery': {
exports: 'jQuery'
},
'select': {
exports: 'Select'
},
'swipe': {
exports: '$'
},
'carousel': {
exports: '$',
deps: ['jQuery']
},
'transition': {
exports: '$',
deps: ['jQuery']
}
}
});
require(['jQuery', 'carousel', 'transition', 'select', 'swipe'], function(jQuery){
jQuery(document).ready(function($) {
// ...
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment