Created
July 9, 2013 09:02
-
-
Save simonewebdesign/5955841 to your computer and use it in GitHub Desktop.
How to use RequireJS with NivoSlider
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
<script src="/scripts/require.js"></script> | |
<script src="/scripts/require.config.js"></script> | |
<script> | |
require(['slider'], function ($) { | |
console.log($); // jquery with slider | |
//console.log($('.slide').nivoSlider({})); | |
}); | |
</script> |
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
requirejs.config({ | |
// If set to true, an error will be thrown if a script loads | |
// that does not call define() or have a shim exports string | |
// value that can be checked. See Catching load failures in | |
// IE for more information. RequireJS enforceDefine | |
enforceDefine: true, | |
// path to libraries | |
baseUrl: '/scripts/', | |
// cache bust! PLEASE REMOVE in production environment | |
urlArgs: 'bust=' + (new Date()).getTime(), | |
paths: { | |
// from the official CDN | |
'jquery': 'http://code.jquery.com/jquery-1.10.1.min', | |
'slider': 'nivo-slider/jquery.nivo.slider' | |
}, | |
shim: { | |
'slider': { | |
deps: ['jquery'], | |
exports: '$' | |
}, | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment