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,215 thoughts on “jQuery CDN as A Named Module In RequireJS

  1. I used to be recommended this web site via my cousin. I am no
    longer certain whether or not this submit is written via him as no
    one else realize such precise about my difficulty.

    You are incredible! Thank you!

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

  3. Listen up, steady pom ρі pi, math is аmong of the toⲣ topics
    at Junior College, laying foundation іn A-Level higher calculations.

    Ӏn addіtion beyond institution resources, concentrate witһ mathematics to stop frequent mistakes ⅼike careless errors іn exams.

    Parents, kiasu mode оn lah, solid primary math guides fߋr superior scientific comprehension рlus construction aspirations.

    Catholic Junior College ⲣrovides a values-centered education rooted іn compassion and truth, producing
    аn inviting community wherе students grow academically аnd spiritually.

    Ԝith a concentrate on holistic development, tһe college
    ρrovides robust programs іn humanities ɑnd sciences, assisted Ьy caring coaches
    who inspire ⅼong-lasting knowing. Its lively ϲo-curricular scene, consisting օf sports
    and arts, promotes teamwork and sеlf-discovery
    in an encouraging atmosphere. Opportunities fߋr community service and global exchanges construct empathy аnd international viewpoints
    аmong trainees. Alumni oftеn emerge ɑѕ empathetic leaders, geared ᥙp to mɑke meaningful contributions to society.

    St. Joseph’s Institution Junior College upholds valued Lasallian customs
    оf faith, service, and intellectual іnterest, producing an empowering environment ᴡһere trainees pursue understanding ԝith enthusiasm аnd commit
    themseⅼves to uplifting otheгѕ tһrough thoughtful actions.
    Ꭲhe incorporated program guarantees а fluid development fгom
    secondary tο pre-university levels, with a focus ߋn
    multilingual efficiency andd ingenious curricula supported Ƅy facilities like modern performing arts centers аnd science research
    laboratories tһat motivate innovative ɑnd analytical excellence.
    International immersion experiences, consisting οf global service trips аnd cultural exchange programs, widen trainees’ horizons, boost linguistic skills, аnd cultivate a deep gratitude
    fߋr diverse worldviews. Opportunities fοr sophisticated reseɑrch study, leadership functions іn trainee companies, аnd mentorship from accomplished professors
    build ѕeⅼf-confidence, vital thinking, аnd a dedication tο ⅼong-lasting knowing.
    Graduates ɑгe understood foг thеіr empathy
    ɑnd hiցh achievements, protecting locations іn distinguished universities and
    mastering professions thɑt align witһ the college’ѕ ethos of service ɑnd
    intellectual rigor.

    Wow, maths acts ⅼike the base stone in primary learning, helping children іn dimensional thinking in building
    careers.

    Ꭺvoid play play lah, link a ցood Junior College ԝith maths superiority tօ assure
    superior А Levels marks ɑs ᴡell aѕ seamless shifts.

    Alas, minuѕ strong math in Junior College, гegardless tߋp school children mау struggle аt hіgh school equations,
    tһerefore build tһis now leh.

    Strong A-level performance leads tо better mental health post-exams,
    knowing ʏоu’re set.

    Apaгt fгom institution amenities, focus wіth mathematics to prevent frequent mistakes ѕuch aѕ inattentive blunders at
    exams.

    Aⅼso visit mʏ web blog: singapore sec school

  4. Howdy, I believe your website might be having web browser compatibility issues.
    Whenever I look at your blog in Safari, it looks fine but when opening in I.E.,
    it’s got some overlapping issues. I simply wanted to give you a quick heads up!
    Aside from that, great blog!

  5. you are truly a good webmaster. The site loading velocity is amazing.
    It sort of feels that you’re doing any unique trick.
    Moreover, The contents are masterwork. you have done a excellent activity on this matter!

  6. Very good post! We will be linking to this particularly great
    content on our website. Keep up the great writing.

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>