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.
Hey! I know this is somewhat off-topic however I needed
to ask. Does running a well-established website like yours require a massive amount work?
I’m brand new to operating a blog however I do write
in my diary daily. I’d like to start a blog so I can easily share my experience and views online.
Please let me know if you have any kind of suggestions or tips for new aspiring bloggers.
Thankyou!
Wonderful blog! I found it while browsing on Yahoo News.
Do you have any suggestions on how to get listed in Yahoo News?
I’ve been trying for a while but I never seem to get there!
Cheers
Remarkable issues here. I am very satisfied to peer your post.
Thanks a lot and I’m taking a look forward to contact you.
Will you please drop me a e-mail?
Touche. Outstanding arguments. Keep up the
amazing work.
Great delivery. Outstanding arguments. Keep up the
good spirit.
I read this article completely regarding the resemblance
of most up-to-date and previous technologies, it’s awesome article.