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.

7,256 thoughts on “jQuery CDN as A Named Module In RequireJS

  1. Unquestionably believe that which you stated.

    Your favorite justification appeared to be on the internet
    the simplest thing to be aware of. I say to you, I certainly get irked while people think about worries that they just
    don’t know about. You managed to hit the nail upon the top as
    well as defined out the whole thing without having side
    effect , people can take a signal. Will probably be back to get more.

    Thanks

  2. Hey there I am so happy I found your weblog, I really found you by mistake, while I was looking on Google for
    something else, Anyhow I am here now and would just like to
    say kudos for a incredible post and a all round interesting blog (I also love the
    theme/design), I don’t have time to go through
    it all at the moment but I have saved it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the awesome job.

  3. Great post. I was checking continuously this blog and I am impressed!
    Extremely useful information specifically the last part :) I care for such info a lot.
    I was seeking this particular information for a long time.
    Thank you and good luck.

  4. My spouse and I stumbled over here by a different web page and thought I should check things out.
    I like what I see so now i’m following you. Look forward to finding out about your
    web page yet again.

  5. Hi, i believe that i saw you visited my website so i got here to return the favor?.I’m attempting to in finding issues too enhance my web site!I suppose its ook to make use off
    a ffew of you concepts!!

  6. An intriguing discussion is worth comment. I think that you need to write more about this issue, it may not be
    a taboo matter but generally folks don’t discuss such topics.

    To the next! All the best!!

  7. Add obscurity for privacy or decorative purpose as primary design element

    Decorative pattern glass with wide selection of distinctive texture like floral
    pattern, geometric shape and abstract motif

    Wide application including door insert, shower enclosure, partition, railing and glass furniture

    discover more at newspacehospitality.com

  8. I truly love your site.. Pleasant colors & theme.
    Did you create this web site yourself? Please reply back as I’m looking to create my very own website and would
    love to learn where you got this from or what
    the theme is named. Appreciate it!

  9. Thanks for some other informative website. The place else may just I get that type
    of information written in such a perfect manner? I have a challenge that I’m just now working on, and I
    have been on the glance out for such info.

  10. LUCK8 – Website chính thức LUCK8F – cổng game đổi thưởng
    uy tín tại Việt Nam. Khám phá giải trí đẳng
    cấp, hệ thống game đa dạng, bảo mật cao, mượt mà cùng cơ hội trúng thưởng khủng và dịch vụ chuyên nghiệp hàng đầu.

  11. Nice post. I learn something totally new and challenging
    on blogs I stumbleupon every day. It will always be helpful to read articles from
    other authors and practice something from other web sites.

  12. id=”firstHeading” class=”firstHeading mw-first-heading”>Search results

    Help

    English

    Tools

    Tools
    move to sidebar hide

    Actions

    General

  13. Paragraph writing is also a fun, if you be familiar with afterward you can write
    if not it is complicated to write.

  14. Hello there! This is kind of off topic but I need some help from an established blog.
    Is it very hard to set up your own blog? I’m not very techincal but
    I can figure things out pretty quick. I’m thinking about setting up my own but I’m not sure where to start.
    Do you have any tips or suggestions? Cheers

  15. After I initially commented I seem to have clicked the -Notify me when new comments are
    added- checkbox and now each time a comment is added I receive 4 emails with
    the same comment. Is there a means you are able to remove me from that service?

    Thank you!

  16. Fantastic blog! Do you have any tips and hints for
    aspiring writers? I’m hoping to start my own website soon but I’m a little lost on everything.

    Would you propose starting with a free platform like WordPress or go
    for a paid option? There are so many options out there that I’m totally confused ..
    Any ideas? Cheers!

  17. Do you mind if I quote a couple of your articles
    as long as I provide credit and sources back to your weblog?

    My blog is in the very same niche as yours and my visitors would
    genuinely benefit from a lot of the information you present here.
    Please let me know if this alright with you.
    Thanks a lot!

  18. Write more, thats all I have to say. Literally, it
    seems as though you relied on the video to make your point.
    You definitely know what youre talking about, why throw away your intelligence on just posting videos to your site when you could be giving us something enlightening to read?

  19. Nice post. I was checking continuously this blog and I’m impressed!
    Very useful information specifically the last part :) I care for such information a lot.
    I was seeking this particular info for a very long time.
    Thank you and best of luck.

  20. hello!,I like your writing so so much! percentage we communicate more approximately your
    article on AOL? I require an expert on this
    house to resolve my problem. May be that’s you!

    Taking a look forward to look you.

  21. Для получения бесплатных вращений
    можно активировать стартовый
    набор, зарегистрировать промокод или обменять баллы лояльности.

  22. This is the perfect webpage for anyone who really wants to find out
    about this topic. You understand a whole lot its almost tough to argue with you (not that I personally will
    need to…HaHa). You definitely put a brand new spin on a subject that has been written about for decades.
    Wonderful stuff, just excellent!

  23. Hello there! Do you know if they make any plugins to help with
    SEO? I’m trying to get my blog to rank for some targeted keywords but I’m
    not seeing very good success. If you know of any please share.

    Many thanks!

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>