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.

20,176 thoughts on “jQuery CDN as A Named Module In RequireJS

  1. Hello There. I found your blog using msn. This is an extremely well
    written article. I’ll be sure to bookmark it and return to
    read more of your useful information. Thanks for the
    post. I’ll definitely return.

  2. My spouse and I stumbled over here different website and thought I might as
    well check things out. I like what I see so now i am following you.
    Look forward to going over your web page again.

  3. No matter if some one searches for his required thing,
    therefore he/she wishes to be available that in detail, thus that thing is maintained
    over here.

  4. Wow, amazing weblog structure! How lengthy have you ever been running
    a blog for? you made running a blog glance easy.
    The full look of your web site is magnificent, let alone the
    content material!

  5. That is really attention-grabbing, You are an overly skilled blogger.
    I have joined your rss feed and sit up for in search of extra of your wonderful post.

    Also, I have shared your site in my social networks

  6. When I initially commented I clicked the “Notify me when new comments are added” checkbox and
    now each time a comment is added I get several e-mails with
    the same comment. Is there any way you can remove people from that service?
    Thanks!

  7. What’s Going down i’m new to this, I stumbled upon this I
    have discovered It absolutely useful and it has aided me
    out loads. I hope to contribute & assist other users like its helped
    me. Good job.

  8. Interested in legal advice after a car accident? These Seattle car accident lawyers seem knowledgeable and approachable. Checking out their expertise could be beneficial for anyone dealing with such situations. accident lawyer

  9. Hi i am kavin, its my first time to commenting anywhere,
    when i read this paragraph i thought i could also
    make comment due to this good paragraph.

  10. These are truly enormous ideas in concerning blogging.
    You have touched some fastidious things here.

    Any way keep up wrinting.

  11. Very quickly this web page will be famous amid all blogging and site-building people, due to it’s fastidious content

  12. It’s in fact very complicated in this full of activity life to listen news
    on Television, thus I simply use the web for that reason, and get the most up-to-date news.

  13. Hi there exceptional website! Does running a blog like this require
    a large amount of work? I have very little understanding of
    computer programming but I was hoping to start my own blog in the near future.

    Anyways, should you have any suggestions or tips for new blog owners please
    share. I know this is off subject but I simply had to ask.

    Many thanks!

  14. Normally I don’t learn post on blogs, but I wish to say that
    this write-up very forced me to try and do it! Your writing style has been amazed me.
    Thanks, quite great post.

  15. Severe hypoglycemia can result in loss of consciousness, seizures, and loss of life if left untreated. Severe hyperglycemia, including DKA and HHS, is a medical emergency that can lead to coma and potentially dying if left untreated. If hypoglycemia remains untreated, it may possibly result in any of the severe symptoms mentioned above, equivalent to seizures, unconsciousness, and, ultimately, loss of life. Milk fats precipitates with casein; milk sugar, however, remains in the supernatant (whey). Almond flour may be better than standard flours in your blood sugar, as it has a low glycemic index and is rich in magnesium. Both almond flour and coconut flour are gluten-free, however coconut flour is tougher to bake with, as it absorbs moisture very effectively and could make the texture of baked items dry and crumbly. Well folks, it looks like we’ve hit the jackpot with seeds! It’s well-known that top blood strain and “bad” LDL cholesterol ranges are danger markers for heart disease. If your body has issues with insulin, glucose can accumulate in your bloodstream, resulting in high blood sugar. Yogurt comprises lactic acid, which is an alpha hydroxy acid (the identical type you’ll discover in prescription pores and skin care treatments) but at a concentration so mild it’s gentle sufficient to use on any pores and skin kind, face and body.

    Here is my homepage; https://www.ge.infn.it/wiki//gpu/index.php?title=10_Tips_To_Sleep_Better_With_Type_2_Diabetes

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>