我有一个非常简单的 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'
];
}
如果我更改 bundle 中的 JavaScript,它不会在开发模式下发布到 web/asset 目录。我每次都必须删除 web/asset 目录才能获得最新版本。这很烦人。我该怎么办?
最佳答案
已经回答了here .
将其添加到您的资源包中:
public $publishOptions = [
'forceCopy' => YII_DEBUG,
];
有关更多选项和详细说明,请查看链接的答案。
关于Yii2 AssetBundle 中的 Javascript 未在更新时发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30662603/