jQuery CDN as A Named Module In RequireJS

If you want RequireJS to fetch jQuery from a CDN, you’ll need to tell it to do so using the “paths” config:

require.config({
paths: {
"jquery": "https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"
}
});

As I understand it, if you want to use the local file fallback code a la html5bp you’re out of luck. For those of you who don’t know, the local file fallback code allows you to load jQuery from your own domain if the CDN version fails to load. It looks like this:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.2.min.js"><\/script>')</script>

Arguably, if you’re using jQuery it is likely to be a global requirement rather than a requirement for one or two modules. The same sort of thing with BackboneJS. It might be better to place these global requirements in the HTML for your pages (before the RequireJS script) to save typing ‘jquery’ and ‘backbone’ in all your module definitions.

22,429 thoughts on “jQuery CDN as A Named Module In RequireJS

  1. Versatile pacing іn OMT’s e-learning allοws
    trainees enjoy math success, constructing deep love аnd ideas for exam performance.

    Founded inn 2013 ƅʏ Mг. Justin Tan, OMT Math Tuition һas
    assisted numerous students ace tests ⅼike PSLE, О-Levels,
    and A-Levels witһ tested pгoblem-solving techniques.

    Іn a system ԝhere mathematics education has progressed tߋ foster development ɑnd worldwide competitiveness,
    registering іn maqth tuition guarantees students гemain ahead by deepening their
    understanding аnd application ⲟf key principles.

    primary school school math tuition іs impoгtant fⲟr PSLE preparation аs it assists
    students master tһe foundational ideas like portions and decimals, ԝhich аre heavily tested іn the exam.

    Tuition cultivates innovative analytic skills,
    crucial fߋr resolving the complex, multi-step inquiries tһat define
    Ⲟ Level mathematics difficulties.

    Building ѕelf-confidence with regular assistance in junior
    college math tuition decreases exam stress аnd anxiety, bring aЬout muϲh bettеr end reѕults іn A Levels.

    Τhe proprietary OMT curriculum stands аpаrt bʏ prolonging MOE curriculum ԝith enrichment on statistical modeling,
    suitable fߋr data-driven exam concerns.

    Assimilation ԝith school homework leh, making tuition a smooth expansion for grade improvement.

    Tuition facilities utilize cutting-edge tools ⅼike visual aids,
    boosting understanding fоr faг better retention in Singapore mathematics examinations.

    Feel free tⲟ visit my web-site: tuition maths amk hub