How do I load third party JavaScript from a CDN when using RequireJS?

This will load jQuery from a CDN: <script src=”http://requirejs.org/docs/release/2.1.5/comments/require.js”></script> <script type=”text/javascript”> require.config({ paths: { “jquery”: “https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min” }, waitSeconds: 40 }); </script> <div id=”message”>hello</div> <script type=”text/javascript”> require( [“jquery”], function ($) { alert($.fn.jquery + “\n” + $(“#message”).text()); } ); </script> Fiddle Here. This page from the requirejs docs shows how to eliminate a path from the optimised … Read more

How to include a CDN to VueJS CLI without NPM or Webpack?

Unfortunately, no, you can’t add a <script> tag to a specific component via template. In your case you have some options: 1: Use NPM Propertly install the dependency using npm Pros: proper usage of NPM and Webpack; scoped definition; Cons: the script must be available as a NPM package. Note: when available this is the … Read more

How to use Bootstrap CDN?

As others have mentioned, using a CDN is usually as easy as adding: <link href=”//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css” rel=”stylesheet”> into your HTML. But this doesn’t work when you are loading your html from a local file. The reason is the missing protocol. When using a CDN, it’s usually a good idea not to specify the protocol, so that … Read more

Sourcing jQuery from a CDN?

jQuery 1.7 registers itself as an AMD module by the name of ‘jquery’, so you need to create a mapping for ‘jquery’ using the paths config: requirejs.config({ paths: { ‘jquery’ : ‘https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min’ } }); require([‘jquery’], function($) { //$ points to jQuery }); Note however that RequireJS loads modules asynchronously and out of order, so if … Read more

jquery ui – how to use google CDN [duplicate]

You can make the call using <link rel=”stylesheet” href=”http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css” type=”text/css” media=”all” /> <script src=”http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.min.js” type=”text/javascript”></script> <script src=”http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js” type=”text/javascript”></script> You can also link to other Ui themes by changes the name of the theme. In This case change the name base to any other theme name /base/jquery-ui.css to any other theme. <link rel=”stylesheet” href=”http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css” type=”text/css” media=”all” … Read more

How to use Semantic UI CDN?

You just need to copy the URL of the files you want to use for Semantic UI, and put it in your header under a script or link tag as the “src” or “href” value. For Semantic UI, you need three files for general use: semantic.min.css jquery.min.js (from JQuery CDN) semantic.min.js For example: <!DOCTYPE HTML> … Read more