ClientScript and AssetManager


I try to understand how AssetManager works. I delete all folders from asset folder, and then just update my main page. After that only one folder has been created 56dbe7a5. When I look into it, I saw there about 15 javascript files and some folders:

But I haven’t any plugins in my main page. I just include some css styles and jquery core.

<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>

<?php Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/blueprint/screen.css', 'screen'); ?>

<?php Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/blueprint/print.css', 'print'); ?>

<?php Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/self.css'); ?>

But even 'em is not in asset folder. CSS files are places in css folder in the root, and jquery is from google library:

'clientScript' => array(

    'scriptMap' => array(

        'jquery.js' => '',

        'jquery.min.js' => '',



So I can’t understand why these scripts has been copied into asset folder.

Are you using grids or other Zii components?

No. On the main page no of that. I even write the menu manually.

Some code from CClientScript


	 * Returns the base URL of all core javascript files.

	 * If the base URL is not explicitly set, this method will publish the whole directory

	 * 'framework/web/js/source' and return the corresponding URL.

	 * @return string the base URL of all core javascript files


	public function getCoreScriptUrl()



			return $this->_baseUrl;


			return $this->_baseUrl=Yii::app()->getAssetManager()->publish(YII_PATH.'/web/js/source');


And you have

<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>

Thanks Lex. I guess I need to use setCoreScriptUrl method in this case, but what directory should I pass into it :blink:

If you want to disable asset publishing by clientScript completely, you can set a dummy value to coreSrciptUrl in your configuration. I use for example a custom js compressor in some projects and thus disabled script publishing completely in production mode like this:


            'coreScriptUrl'=>'dummy value', // required to prevent asset publishing of core scripts






Thanks Mike. It works, but if I write:

'*.js'=>false, '*.css'=>false,

it does not publicate any script and styles at all. You maybe brings all javascript files together in one file, and the same with CSS, and then pulicate ones manually. I wanna do this too but dont know the right way.

I saw an extension for it, but I could not make it working.