Simplest requirejs jQuery.noConflict() wrapper
Because we often want to run jQuery in noConflict mode we have a simple wrapper module that returns the noConflict jQuery object.
define(["jquery-1.7"], function(){
return jQuery.noConflict(true);
});
In the requirejs config looks like this:
requirejs.config({
paths: {
"jquery-1.7": ["//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min", "vendor/jquery-1.7.2.min"], // Don't use this one as a direct dependency! Use require-jquery
"require-jquery" : "src/require-jquery"
}
});
And we use the require-jquery module as a dependency wherever we use jQuery.
Written by Flurin Egger
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Amd
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#