Downloading jQuery UI CSS from Google's CDN
JqueryCssJquery UiCdnGoogle Ajax-LibrariesJquery Problem Overview
I am planning on using Google to download the jQuery lib for both UI and Core. My question is, do they allow me to download the CSS for it or should I have to host it myself?
Also if I use Google to load how should I load other plugins? Can I compress all plugins together or should it be its own separate file?
Jquery Solutions
Solution 1 - Jquery
The Google AJAX Libraries API, which includes jQuery UI (currently v1.10.3), also includes popular themes as per the jQuery UI blog:
Google Ajax Libraries API (CDN)
-
Uncompressed: http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js">http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js</a>
-
Themes Uncompressed: http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/black-tie/jquery-ui.css">black-tie</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/blitzer/jquery-ui.css">blitzer</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/cupertino/jquery-ui.css">cupertino</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/dark-hive/jquery-ui.css">dark-hive</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/dot-luv/jquery-ui.css">dot-luv</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/eggplant/jquery-ui.css">eggplant</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/excite-bike/jquery-ui.css">excite-bike</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/flick/jquery-ui.css">flick</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/hot-sneaks/jquery-ui.css">hot-sneaks</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/humanity/jquery-ui.css">humanity</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/le-frog/jquery-ui.css">le-frog</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/mint-choc/jquery-ui.css">mint-choc</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/overcast/jquery-ui.css">overcast</a>,<a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/pepper-grinder/jquery-ui.css">pepper-grinder</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css">redmond</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.css">smoothness</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/south-street/jquery-ui.css">south-street</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/start/jquery-ui.css">start</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/sunny/jquery-ui.css">sunny</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/swanky-purse/jquery-ui.css">swanky-purse</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/trontastic/jquery-ui.css">trontastic</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-darkness/jquery-ui.css">ui-darkness</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-lightness/jquery-ui.css">ui-lightness</a>;, and http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/vader/jquery-ui.css">vader</a>;.
-
Themes Compressed: http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/black-tie/jquery-ui.min.css">black-tie</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/blitzer/jquery-ui.min.css">blitzer</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/cupertino/jquery-ui.min.css">cupertino</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/dark-hive/jquery-ui.min.css">dark-hive</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/dot-luv/jquery-ui.min.css">dot-luv</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/eggplant/jquery-ui.min.css">eggplant</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/excite-bike/jquery-ui.min.css">excite-bike</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/flick/jquery-ui.min.css">flick</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/hot-sneaks/jquery-ui.min.css">hot-sneaks</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/humanity/jquery-ui.min.css">humanity</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/le-frog/jquery-ui.min.css">le-frog</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/mint-choc/jquery-ui.min.css">mint-choc</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/overcast/jquery-ui.min.css">overcast</a>,<a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/pepper-grinder/jquery-ui.min.css">pepper-grinder</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.min.css">redmond</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.min.css">smoothness</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/south-street/jquery-ui.min.css">south-street</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/start/jquery-ui.min.css">start</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/sunny/jquery-ui.min.css">sunny</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/swanky-purse/jquery-ui.min.css">swanky-purse</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/trontastic/jquery-ui.min.css">trontastic</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-darkness/jquery-ui.min.css">ui-darkness</a>;, http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-lightness/jquery-ui.min.css">ui-lightness</a>;, and http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/vader/jquery-ui.min.css">vader</a>;.
Solution 2 - Jquery
jQuery now has a CDN access:
code.jquery.com/ui/[version]/themes/[theme name]/jquery-ui.css
And to make this a little more easy, Here you go:
- base: http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css
- black-tie: http://code.jquery.com/ui/1.9.1/themes/black-tie/jquery-ui.css
- blitzer: http://code.jquery.com/ui/1.9.1/themes/blitzer/jquery-ui.css
- cupertino: http://code.jquery.com/ui/1.9.1/themes/cupertino/jquery-ui.css
- dark-hive: http://code.jquery.com/ui/1.9.1/themes/dark-hive/jquery-ui.css
- dot-luv: http://code.jquery.com/ui/1.9.1/themes/dot-luv/jquery-ui.css
- eggplant: http://code.jquery.com/ui/1.9.1/themes/eggplant/jquery-ui.css
- excite-bike: http://code.jquery.com/ui/1.9.1/themes/excite-bike/jquery-ui.css
- flick: http://code.jquery.com/ui/1.9.1/themes/flick/jquery-ui.css
- hot-sneaks: http://code.jquery.com/ui/1.9.1/themes/hot-sneaks/jquery-ui.css
- humanity: http://code.jquery.com/ui/1.9.1/themes/humanity/jquery-ui.css
- le-frog: http://code.jquery.com/ui/1.9.1/themes/le-frog/jquery-ui.css
- mint-choc: http://code.jquery.com/ui/1.9.1/themes/mint-choc/jquery-ui.css
- overcast: http://code.jquery.com/ui/1.9.1/themes/overcast/jquery-ui.css
- pepper-grinder: http://code.jquery.com/ui/1.9.1/themes/pepper-grinder/jquery-ui.css
- redmond: http://code.jquery.com/ui/1.9.1/themes/redmond/jquery-ui.css
- smoothness: http://code.jquery.com/ui/1.9.1/themes/smoothness/jquery-ui.css
- south-street: http://code.jquery.com/ui/1.9.1/themes/south-street/jquery-ui.css
- start: http://code.jquery.com/ui/1.9.1/themes/start/jquery-ui.css
- sunny: http://code.jquery.com/ui/1.9.1/themes/sunny/jquery-ui.css
- swanky-purse: http://code.jquery.com/ui/1.9.1/themes/swanky-purse/jquery-ui.css
- trontastic: http://code.jquery.com/ui/1.9.1/themes/trontastic/jquery-ui.css
- ui-darkness: http://code.jquery.com/ui/1.9.1/themes/ui-darkness/jquery-ui.css
- ui-lightness: http://code.jquery.com/ui/1.9.1/themes/ui-lightness/jquery-ui.css
- vader: http://code.jquery.com/ui/1.9.1/themes/vader/jquery-ui.css
Solution 3 - Jquery
Google is hosting jQueryUI css at this link https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.css
If you look at this code directly, it is importing the css using @import which can be slow. You may want to factor the import into its parts to gain a slight performance benefit:
https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.base.css https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.theme.css
Solution 4 - Jquery
As Obama says "Yes We Can". Here is the link to it. developers.google.com/#jquery
You need to use
ajax.googleapis.com/ajax/libs/jqueryui/[VERSION NO]/jquery-ui.min.js
ajax.googleapis.com/ajax/libs/jqueryui/[VERSION NO]/themes/[THEME NAME]/jquery-ui.min.css
jQuery CDN
code.jquery.com/ui/[VERSION NO]/jquery-ui.min.js
code.jquery.com/ui/[VERSION NO]/themes/[THEME NAME]/jquery-ui.min.css
Microsoft
ajax.aspnetcdn.com/ajax/jquery.ui/[VERSION NO]/jquery-ui.min.js
ajax.aspnetcdn.com/ajax/jquery.ui/[VERSION NO]/themes/[THEME NAME]/jquery-ui.min.css
Find theme names here http://jqueryui.com/themeroller/ in gallery subtab
.
But i would not recommend you hosting from cdn for the following reasons
- Although your chance of hit rate is good in case of Google CDN compared to others but it's still abysmally low.(any cdn not just google).
- Loading via cdn you will have 3 requests one for jQuery.js, one for jQueryUI.js and one for your code. You might as will compress it on your local and load it as one single resource.
http://zoompf.com/blog/2010/01/should-you-use-javascript-library-cdns
Solution 5 - Jquery
I would think so. Why not? Wouldn't be much of a CDN w/o offering the CSS to support the script files
This link suggests that they are:
> We find it particularly exciting that > the jQuery UI CSS themes are now > hosted on Google's Ajax Libraries CDN.
Solution 6 - Jquery
You could use this one if you mean the jQuery UI css:
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />