Force Yii to republish assets every page refresh

During webapp development you’ll need often assets republication. When you publish assets using directory path, framework won’t republish them automaticaly. So what can you do? It’s plain simple. Use YII_DEBUG constant as fourth argument in publish function.

$assetPath = Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.modules.components.assets'), false, 1, YII_DEBUG);

From this moment Yii will republish assets on every page refresh only in debug mode (it won’t consume your resources in production mode).



Posted

in

,

Comments

0 responses to “Force Yii to republish assets every page refresh”

  1. bhavana Avatar

    Thanks for shairing information about Yii Development.

  2. louis Avatar
    louis

    and where are we supposed to put this code ?

    1. Konrad Fedorczyk Avatar
      Konrad Fedorczyk

      This article will give you pretty good explanation about assets in Yii: http://www.yiiframework.com/wiki/148/understanding-assets/

  3. Alexander Avatar

    Well! Yii can be used to develop web applications of any kind and keeping to any scale or magnitude, its effectiveness shines through in projects which require a heavy flow of data.