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. Heya i am for the first time here. I found
    this board and I find It really useful & it helped
    me out a lot. I hope to give something back and help others like you aided
    me.

  2. Wow, wonderful blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your
    site is magnificent, as well as the content!

  3. Hi there, all is going perfectly here and ofcourse every one is sharing facts, that’s genuinely fine, keep up writing.

  4. excellent points altogether, you simply won a new reader.

    What may you suggest about your publish that you just made
    a few days ago? Any certain?

  5. Hi! Would you mind if I share your blog
    with my myspace group? There’s a lot of folks that I think would really enjoy your content.
    Please let me know. Many thanks

  6. $5 deposit pokies australia, blackjack mulligan uk and what is the most trusted online casino in united states, or best online casino
    for slots uk

    Feel free to visit my web blog … es casinoslam (Willis)

  7. I’ve been surfing online more than three hours today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. In my view, if
    all website owners and bloggers made good content as you
    did, the internet will be much more useful than ever before.

  8. This design is steller! You most certainly know how to keep
    a reader entertained. Between your wit and your videos, I was almost
    moved to start my own blog (well, almost…HaHa!) Great job.
    I really enjoyed what you had to say, and more than that, how you presented it.
    Too cool!

  9. Wall mounted Corian lavatory ramp washbasin, floating bathroom acrylic solid surface vanity with ramp
    sink

    This floating bathroom vanity is made of world-renowned
    Corian acrylic solid surface imported from the U.S and make the fabrication in China.

    Corian has wide range of color options, patterns and style.
    As a man-made mixture, Corian offers flexbilitty in design, allowing bathroom interior designer to selec from a palette of color
    and finishes. Sleek and modern look or a timeless classic vibe, Corian solid surface can provide the perfect bathroom vanity top and basin to completement any bathroom decor
    and style

  10. Lumina Solar is known as the leading solar panel installation company working in Fauquier County, VA.
    Fauquier County extends over approximately 651 square
    miles and has a population of around 72,000 residents, many of whom pursue efficient and sustainable energy solutions.
    Lumina Solar’s expertise is essential in this region where average
    solar irradiance ranges from about 4.5 to 5.0 kWh/m²/day, making solar power a highly viable
    option. The county’s mix of rural and suburban areas,
    including points of interest like Warrenton and the nearby
    Skyline Drive, presents diverse installation challenges that Lumina Solar expertly manages
    to optimize energy capture for homeowners and businesses alike.
    Fauquier County’s median household income is over $90,
    000, indicating a community capable of investing in renewable energy upgrades.

    Lumina Solar’s tailored approach meets the specific needs of this demographic, providing efficient,
    cost-effective installations. Their technical knowledge and local service commitment enable them to handle
    everything from residential rooftops to large-scale
    commercial projects, making Lumina Solar the trusted partner for solar solutions in Fauquier
    County, VA.

  11. Hey there this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors
    or if you have to manually code with HTML. I’m starting a
    blog soon but have no coding expertise so I
    wanted to get guidance from someone with experience. Any help would be enormously appreciated!

  12. Thank you a lot for sharing this with all people you really understand what you are talking approximately!
    Bookmarked. Kindly also consult with my website =). We may have a link trade arrangement between us

  13. Hi there to every , for the reason that I am truly eager of reading this webpage’s post to be updated daily.

    It carries nice data.

  14. We’re a group of volunteers and starting a brand new scheme in our community.
    Your site offered us with useful information to work on. You have
    performed an impressive task and our whole group might be grateful to you.

  15. I do not even know the way I ended up right here, but I
    thought this put up was great. I don’t recognize who
    you’re however certainly you’re going to a well-known blogger if you happen to are not already.
    Cheers!