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.

16,272 thoughts on “jQuery CDN as A Named Module In RequireJS

  1. Power Plumbing Heating & Air made finding a reliable plumber in Anaheim so easy, and their service exceeded my expectations.
    I am so happy with Power Plumbing Heating & Air, the best plumber Anaheim could offer, and their team was so friendly plumber

  2. Its like you learn my thoughts! You seem to grasp so much
    about this, such as you wrote the guide in it or something.

    I think that you could do with a few % to power the message home a bit,
    however instead of that, this is wonderful blog. A fantastic read.
    I’ll certainly be back.

  3. Hurrah! At last I got a web site from where I can really take valuable facts
    concerning my study and knowledge.

  4. OMT’s enrichment activities ƅeyond the curriculum
    reveal mathematics’ѕ unlimited opportunities, firing ᥙp passion and
    exam ambition.

    Unlock ʏour kid’s сomplete potential in mathematics wіth OMT Math Tuition’s expert-led classes, tailored tо Singapore’s MOE curriculum fοr primary, secondary,
    ɑnd JC students.

    Ԝith mathematics incorporated effortlessly іnto Singapore’s class settings to benefit both
    instructors and students, devoted math tuition amplifies
    tһeѕe gains by using tailored assistance fօr sustained accomplishment.

    Ԝith PSLE mathematics developing tо consist of more
    interdisciplinary components, tuition ҝeeps students updated օn incorporated questions mixing
    math ᴡith science contexts.

    Math tuition educates efficient tіme management strategies, aiding secondary trainees totɑl O Level exams
    ѡithin the designated duration wіthout rushing.

    Thгough routine simulated tests ɑnd thorough responses, tuition assists junior college trainees recognize ɑnd fix weak points befoгe tһe actual A Levels.

    Distinctly, OMT matches tһe MOE curriculum ѡith a personalized
    program featuring analysis assessments tօ tailor web content per
    trainee’s staminas.

    Personalized progression tracking іn OMT’s sʏstem reveals your weak areas sіa, allowing targeted
    method fοr quality renovation.

    Вy stressing theoretical understanding оver rote learning, math tuition equips Singapore pupils
    fоr the advancing exam formats.

    ᒪ᧐ok at my pagе: pmt physics and maths tutor practical cylinder (https://iti.vnu.edu.vn/)

  5. I delight in, result in I discovered just what I used to
    be having a look for. You’ve ended my 4 day lengthy hunt!
    God Bless you man. Have a nice day. Bye

    Also visit my wweb site: Betty

  6. Have you ever thought about including a little
    bit more than just your articles? I mean, what you
    say is important and all. However think of if you added some
    great graphics or videos to give your posts more,
    “pop”! Your content is excellent but with pics and video clips, this blog could undeniably be one of the very best in its field.
    Wonderful blog!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>