我最近安装了YI2.0.6,我注意到它装载
yii.js
yii.validation.js
yii.activeForm.js在yiisoft/yii2/assets文件夹中,我想要覆盖这些文件,在common/config/main.php中我添加了这些代码行,但是它所做的是只替换yii.js文件,而yii.validation.js和yii.activeForm.js继续加载。
'assetManager' => [
'forceCopy' => YII_DEBUG,
'bundles' => [
'yii\web\YiiAsset' => [
'js' => ['all.min.js'],
],
],
],如何用一个文件替换所有这些文件?
发布于 2015-10-07 15:15:31
发布于 2015-10-07 15:04:49
来自文档:
- Set the css and js properties to be the combined CSS and JavaScript files, respectively.
- Customize the asset bundles in each group by setting their css and js properties to be empty, and setting their depends property to be the new asset bundle created for the group.
因此,您需要使用一个工具来压缩您的文件,然后将每个文件注入到其适当的包中:
'assetManager' => [
'bundles' => [
'all' => [
'class' => 'yii\web\AssetBundle',
'basePath' => '@webroot/assets',
'baseUrl' => '@web/assets',
'css' => ['all-xyz.css'],
'js' => ['all-xyz.js'],
],
'A' => ['css' => [], 'js' => [], 'depends' => ['all']],
'B' => ['css' => [], 'js' => [], 'depends' => ['all']],
'C' => ['css' => [], 'js' => [], 'depends' => ['all']],
'D' => ['css' => [], 'js' => [], 'depends' => ['all']],
],有关更多信息,请参见官方文件。
https://stackoverflow.com/questions/32994744
复制相似问题