0

I have a quite simple AssetBundle:

use yii\web\AssetBundle;

/**
 * ImagizerAsset
 */
class ImagizerAsset extends AssetBundle
{
    public $sourcePath = '@app/components/widgets/imagizer/assets';

    public $css = [
        'css/imagizer.css'
    ];

    public $js = [
        'js/imagizer.js',
    ];

    public $depends = [
        'app\assets\BowerCropperAsset'
    ];
}

If I change the JavaScript in the bundle, it is not published to the web/asset directory in development mode. I must remove the web/asset directory every time to have an up to date version in it. It is very annoying. What should I do?

Tibor Nagy
  • 1,185
  • 1
  • 15
  • 28
  • possible duplicate of [How do I disable assets caching in Yii2?](http://stackoverflow.com/questions/28040018/how-do-i-disable-assets-caching-in-yii2) – arogachev Jun 05 '15 at 09:42

1 Answers1

1

It's already answered here.

Add this to your asset bundle:

public $publishOptions = [
    'forceCopy' => YII_DEBUG,
];

For more options and detailed explanation look at linked answer.

Community
  • 1
  • 1
arogachev
  • 33,150
  • 7
  • 114
  • 117