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.

11,316 thoughts on “jQuery CDN as A Named Module In RequireJS

  1. درود و احترام محمد
    بهتره امتحان کنید
    سایت والیبال بت
    رو در زمینه انفجار.
    این پلتفرم حرفه ای تنوع
    ورزش‌ها و برای رولت بازها مناسبه.

    کیفیت سرویس عالی و توصیه ویژه دارم.

    سپاس.

  2. وقتتون بخیر
    حتما سر بزنید
    سایت کرش آنلاین
    رو جهت پوکر حرفه ای.
    این پلتفرم پیشرفته پرداخت مطمئن و برای کرش گیم عالیه.

    برای ایرانی‌ها عالیه و توصیه دارم ببینید سایت رو.

    سپاس علی.

  3. Fırat Engin bahis siteleri, Casino Siteleri Nargül Engin, Slot Siteleri
    Hüseyin Engin, Deneme Bonusu Veren Siteler Ahmet Engin, Mehdi Deneme
    Bonusu, Mehdi Deneme bonusu veren siteler

  4. سلام گرم
    توصیه دارم تست کنید
    سایت بوکس پیش بینی
    رو جهت کرش.
    این سایت عالی ضرایب رقابتی و برای
    انفجار 2 جذابه.
    دوستانم پیشنهاد دادن و توصیه دارم
    ببینید سایت رو.
    با تشکر.

  5. Hmm is anyone else experiencing problems with the pictures on this blog loading?
    I’m trying to figure out if its a problem on my end or if it’s the blog.
    Any feedback would be greatly appreciated.

  6. Link exchange is nothing else except it is just placing
    the other person’s website link on your page at proper place and other person will
    also do similar in favor of you.

  7. You could definitely see your skills within the article you write.

    The arena hopes for even more passionate writers
    like you who are not afraid to say how they believe. Always follow your
    heart.

  8. Heya are using WordPress for your blog platform? I’m new to the
    blog world but I’m trying to get started and create my own. Do you require any html coding knowledge to make your own blog?
    Any help would be greatly appreciated!

  9. Hi this is kinda 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 skills so I wanted to get guidance from someone with experience.
    Any help would be enormously appreciated!

  10. Изучите наш сайт Все последние новости и возможности в одном месте.

  11. Thanks for your marvelous posting! I quite enjoyed reading it, you will be a great
    author. I will be sure to bookmark your blog and will often come back at some point.
    I want to encourage you to ultimately continue your
    great writing, have a nice day!

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>