How to register jquery-ui CSS file in Yii 1.1.4?

In Yii 1.1.4, jquery-ui becomes a core script. So we can register jquery-ui with the following code:


Yii::app()->clientScript->registerCoreScript('jquery.ui');

However, this code only register the JS file but not the CSS file. So how to register jquery-ui CSS file?

What I did was:




'clientScript' => array(

        	'scriptMap' => array(

				'jquery-ui.css'=>false,

			)

		),



And manually included a copy of the jQuery UI in my templates. that way the CSS files and images are always avaliable wheter or not you are using a jQuery UI widget (you can also include them dinamicaly but youll still need a copy of the jqueryui resources in your project)

I was looking at the CJuiWidget implementation, it takes care of theming and stuff before registering the CSS files, so, if you want something dinamic like that, ill guess youll have to build a Helper class of somekind.

Asgaroth,

Another way is to make own package. Details are in class reference.




$cs = Yii::app()->getClientScript();

$cs->packages = array(

       'jquery.ui'=>array(

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

                'css'=>array('jui/css/redmond/jquery-ui.css'),

		'depends'=>array('jquery'),

	),

);

$cs->registerCoreScript('jquery.ui');