Javascript Yii2 AssetBundle 未在更新时发布
Javascript in Yii2 AssetBundle is not published on update
我有一个非常简单的 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'
];
}
如果我更改包中的 JavaScript,它不会发布到开发模式下的 web/asset 目录。我必须每次都删除 web/asset 目录以在其中包含最新版本。这很烦人。我该怎么办?
已经回答。
将此添加到您的资产包中:
public $publishOptions = [
'forceCopy' => YII_DEBUG,
];
有关更多选项和详细说明,请查看链接的答案。
我有一个非常简单的 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'
];
}
如果我更改包中的 JavaScript,它不会发布到开发模式下的 web/asset 目录。我必须每次都删除 web/asset 目录以在其中包含最新版本。这很烦人。我该怎么办?
已经回答
将此添加到您的资产包中:
public $publishOptions = [
'forceCopy' => YII_DEBUG,
];
有关更多选项和详细说明,请查看链接的答案。