使用闭包编译器和yuicompresser进行Yii2资产压缩
我使用以下命令在应用程序的根目录中生成assets.phpyii-asset/template-assets.php assets.php使用闭包编译器和yuicompresser进行Yii2资产压缩,yii2,assets,yui,google-closure-compiler,Yii2,Assets,Yui,Google Closure Compiler,我使用以下命令在应用程序的根目录中生成assets.phpyii-asset/template-assets.php assets.php <?php /** * Configuration file for the "yii asset" console command. */ // In the console environment, some path al
<?php
/**
* Configuration file for the "yii asset" console command.
*/
// In the console environment, some path aliases may not exist. Please define these:
// Yii::setAlias('@webroot', __DIR__ . '/../web');
// Yii::setAlias('@web', '/');
return [
// Adjust command/callback for JavaScript files compressing:
'jsCompressor' => 'java -jar compiler.jar --js {from} --js_output_file {to}',
// Adjust command/callback for CSS files compressing:
'cssCompressor' => 'java -jar yuicompressor.jar --type css {from} -o {to}',
// The list of asset bundles to compress:
'bundles' => [
// 'app\assets\AppAsset',
// 'yii\web\YiiAsset',
// 'yii\web\JqueryAsset',
],
// Asset bundle for compression output:
'targets' => [
'all' => [
'class' => 'yii\web\AssetBundle',
'basePath' => 'C:/wamp/www/flywings/frontend/web/assets',
'baseUrl' => '/flywings/frontend/web/assets',
'js' => 'js/all-{hash}.js',
'css' => 'css/all-{hash}.css',
],
],
// Asset manager configuration:
'assetManager' => [
//'basePath' => '@webroot/assets',
//'baseUrl' => '@web/assets',
],
];