Question regarding jquery and jqueryui

I was looking on how to use google cdn for serving jquery and came across this code for the main config under components:

'clientScript' => array(

	'packages' => array(

		'jquery' => array(

			'baseUrl' => '//',

			'js' => array('jquery.min.js'),




So that works fine and dandy. I then figured I would do the same with jqueryui, so I added the following

'jquery.ui' => array(

	'baseUrl' => '//',

	'js' => array('jquery-ui.min.js'),


It works but I noticed that doing this makes jqueryui load up first before jquery, thus giving me “jquery not defined” errors. I’m including jqueryui in my view files using the following:


Only way I could get jquery to load up first is to register it as well before jqueryui:



Is this correct, or am I missing something?

Have you checked this?

Hi wisp. Yup, was the first one I ran into when searching for how to serve the js files from google’s cdn. I just modified it to import jquery ui as well (I don’t use the widget factory so I skipped the widgetFactory section of the config)

JQuery isn’t loaded by default. When a widget is used, JQuery will then be loaded automatically.

Since you don’t use the widgets, JQuery will probably never be loaded.

Your solution is fine and is how it should be done.

He used registercorescript, so that should load jquery… I’m not sure what else could be wrong