Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii - How to cause Yii to republish to the assets folder

Tags:

assets

yii

Yii question.

On my development machine, the required JQuery files for the application were present in a subfolder under the assets folder. However, when I copied the application to my test server, JQuery files were missing in the folder yii looked for them. I kept getting errors such as '../assets/db0e5a94/jquery.ba-bbq.js' 404 not found, etc.

I emptied the assets folder, and now all my CSS files etc. are reported missing. Is there any way I can cause Yii to republish to the assets folder?

Thanks!

like image 871
ARV Avatar asked May 08 '12 18:05

ARV


2 Answers

Simply delete all sub-directories in the assets folder and clear your browser cache. Do not delete the assets directory or you will have to set the write permissions again.

like image 142
Samuel Liew Avatar answered Sep 30 '22 22:09

Samuel Liew


in components/Controller.php add the following function:

protected function beforeAction($action){
    if(defined('YII_DEBUG') && YII_DEBUG){
        Yii::app()->assetManager->forceCopy = true;
    }
    return parent::beforeAction($action);
}
like image 35
Waqar Alamgir Avatar answered Sep 30 '22 21:09

Waqar Alamgir