作者:阆中猫猫覀_648 | 来源:互联网 | 2023-10-11 15:17
AssetbundlegenerateemptyJavaScriptandCSSfiles资产包生成空的JavaScript和CSS文件namespacefrontend\ass
Asset bundle generate empty Javascript and CSS files
资产包生成空的Javascript和CSS文件
namespace frontend\assets;
return [
'bundles' => [
'frontend\assets\AppAsset',
],
'targets' => [
'frontend\assets\AppAsset' => [
'basePath' => 'e:/path/yii2.loc/www',
'baseUrl' => '',
'js' => 'js/{ts}.js',
'css' => 'css/{ts}.css',
],
],
'assetManager' => [
'basePath' => 'e:/path/yii2.loc/www/assets',
'baseUrl' => '',
],
];
config.php
config。
return [
'bundles' => [
'frontend\assets\AppAsset',
],
'targets' => [
'frontend\assets\AppAsset' => [
'basePath' => 'e:/path/yii2.loc/www',
'baseUrl' => '',
'js' => 'cache/{ts}.js',
'css' => 'cache/{ts}.css',
],
],
'assetManager' => [
'basePath' => 'e:/path/yii2.loc/www/assets',
'baseUrl' => '',
],
];
Then in console
然后在控制台
yii asset e:\path\config.php e:\path\compressed.php
//compresed.php it's result file with name of compressed files
And in config
在配置
'assetManager' => [
'bundles' => require dirname(__DIR__) . '/assets/compressed.php',
],
CSS and Javascript files are in a directory:
CSS和Javascript文件在一个目录中:
e:/path/yii2.loc/www/css
艾凡:/ yii2.loc / www / css /路径
And
和
e:/path/yii2.loc/www/js
艾凡:/ yii2.loc / www / js /路径
Bundle generate empties to:
包生成清空:
e:/path/yii2.loc/www/cache/css and e:/path/yii2.loc/www/cache/js
艾凡:/ / yii2路径。loc / www /缓存/ css和e:/道路/ yii2.loc / www /缓存/ js
What did I do wrong?
我做错了什么?
1 个解决方案