Created
November 3, 2014 04:33
-
-
Save bencooling/f53012b8619a4560e223 to your computer and use it in GitHub Desktop.
requirejs implementation that won't override global jQuery
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
'use strict'; | |
/* | |
|-------------------------------------------------------------------------- | |
| Requirejs configuration | |
|-------------------------------------------------------------------------- | |
| | |
| This file is used by both the browser & command line optomisation | |
| tool (see gruntfile.js) | |
| | |
| baseUrl | |
| data-main script (this file) is in the assets directory, while all | |
| external library scripts are within js subdirectory | |
| | |
| paths | |
| set paths for external libraries and main which is not in directory above baseUrl | |
| | |
| shim | |
| Non AMD jquery plugins need to be explicitly set as a jquery dependency | |
| | |
| private jquery wont clobber global jQuery variable | |
| | |
*/ | |
require.config({ | |
baseUrl: './../', | |
paths: { | |
'jquery' : 'assets/vendor/jquery/dist/jquery' | |
} | |
}); | |
define('jquery-private', ['jquery'], function (jq) { | |
return jq.noConflict( true ); | |
}); | |
require(['jquery-private'], function($){ | |
console.log( '$.fn.jquery ', $.fn.jquery ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment