Yii: Integrating A Css-File On The Module Level

Hello together,

an excerpt from my

    protected/config/main.php // given situation

looks like:

    'modules' => array(

        'services' => array(

            'modules' => array(







and for "myModule" I want to integrate a CSS-File. I could not find information about this issue in the documentation. How could I add a CSS-File on the module-level?

Something like that would be for example awesome:

	'myModule' => array(

		'css-file' => array(

			'css-file-name' => css-file-path,



thank you very much…


you have to override some method

In config file

you can add

‘cssFile’ =>‘mymodule.css’;

in your mymoduleModule.php

public $cssFile= "mymodule.css";

[size=2] [/size][size=2]private function _publishModuleAssets() {[/size]

	if (is_null($this->_cs))

		$this->_cs = Yii::app()->getClientScript();


	if($this->cssFile!==false) {


			$this->cssFile= $this->baseScriptUrl.'/css/styles.css';




I hope this will work :) cheers

thank you, I did the following and it worked for me:

// change to the module directory and find 

// the myModuleNameModule.php file and add the following 

// (into the function init()):

$file = Yii::getPathOfAlias('myModuleName').DIRECTORY_SEPARATOR."further_directory_structure";

$url  = Yii::app()->getAssetManager()->publish($file);

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