25
資產包產生空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
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' => '',
],
];
然後在控制檯
yii asset e:\path\config.php e:\path\compressed.php
//compresed.php it's result file with name of compressed files
而且在配置
'assetManager' => [
'bundles' => require dirname(__DIR__) . '/assets/compressed.php',
],
CSS和JavaScript文件在目錄:
E:/path/yii2.loc/www/css
而且
E:/路徑/ yii2。 LOC/WWW/JS
包生成排空到:
E:/path/yii2.loc/www/cache/css和e:/path/yii2.loc/www/cache/js
我做了什麼錯?
你發現了什麼問題? 因爲我不能配置資產捆綁器工作。 –
也一樣。它在做js而不是css。你是如何設法解決這個問題的? – Flion
您註冊了嗎?你的資產imean? – mohsen