|
|
|
@ -14,6 +14,7 @@ use yii\helpers\Console;
|
|
|
|
|
use yii\helpers\FileHelper; |
|
|
|
|
use yii\helpers\VarDumper; |
|
|
|
|
use yii\web\AssetBundle; |
|
|
|
|
use yii\web\AssetManager; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Allows you to combine and compress your JavaScript and CSS files. |
|
|
|
@ -37,7 +38,7 @@ use yii\web\AssetBundle;
|
|
|
|
|
* Note: by default this command relies on an external tools to perform actual files compression, |
|
|
|
|
* check [[jsCompressor]] and [[cssCompressor]] for more details. |
|
|
|
|
* |
|
|
|
|
* @property \yii\web\AssetManager $assetManager Asset manager instance. Note that the type of this property |
|
|
|
|
* @property AssetManager $assetManager Asset manager instance. Note that the type of this property |
|
|
|
|
* differs in getter and setter. See [[getAssetManager()]] and [[setAssetManager()]] for details. |
|
|
|
|
* |
|
|
|
|
* @author Qiang Xue <qiang.xue@gmail.com> |
|
|
|
@ -80,8 +81,8 @@ class AssetController extends Controller
|
|
|
|
|
* 'css' => 'css/all-shared-{hash}.css', |
|
|
|
|
* 'depends' => [ |
|
|
|
|
* // Include all assets shared between 'backend' and 'frontend' |
|
|
|
|
* 'yii\web\YiiAsset', |
|
|
|
|
* 'app\assets\SharedAsset', |
|
|
|
|
* \yii\web\YiiAsset::class, |
|
|
|
|
* \app\assets\SharedAsset::class, |
|
|
|
|
* ], |
|
|
|
|
* ], |
|
|
|
|
* 'allBackEnd' => [ |
|
|
|
@ -89,7 +90,7 @@ class AssetController extends Controller
|
|
|
|
|
* 'css' => 'css/all-{hash}.css', |
|
|
|
|
* 'depends' => [ |
|
|
|
|
* // Include only 'backend' assets: |
|
|
|
|
* 'app\assets\AdminAsset' |
|
|
|
|
* \app\assets\AdminAsset::class |
|
|
|
|
* ], |
|
|
|
|
* ], |
|
|
|
|
* 'allFrontEnd' => [ |
|
|
|
@ -122,7 +123,7 @@ class AssetController extends Controller
|
|
|
|
|
public $cssCompressor = 'java -jar yuicompressor.jar --type css {from} -o {to}'; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @var array|\yii\web\AssetManager [[\yii\web\AssetManager]] instance or its array configuration, which will be used |
|
|
|
|
* @var array|AssetManager [[AssetManager]] instance or its array configuration, which will be used |
|
|
|
|
* for assets processing. |
|
|
|
|
*/ |
|
|
|
|
private $_assetManager = []; |
|
|
|
@ -137,8 +138,8 @@ class AssetController extends Controller
|
|
|
|
|
{ |
|
|
|
|
if (!is_object($this->_assetManager)) { |
|
|
|
|
$options = $this->_assetManager; |
|
|
|
|
if (!isset($options['class'])) { |
|
|
|
|
$options['class'] = 'yii\\web\\AssetManager'; |
|
|
|
|
if (empty($options['class'])) { |
|
|
|
|
$options['class'] = AssetManager::class; |
|
|
|
|
} |
|
|
|
|
if (!isset($options['basePath'])) { |
|
|
|
|
throw new Exception("Please specify 'basePath' for the 'assetManager' option."); |
|
|
|
@ -154,8 +155,8 @@ class AssetController extends Controller
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets asset manager instance or configuration. |
|
|
|
|
* @param \yii\web\AssetManager|array $assetManager asset manager instance or its array configuration. |
|
|
|
|
* @throws \yii\console\Exception on invalid argument type. |
|
|
|
|
* @param AssetManager|array $assetManager asset manager instance or its array configuration. |
|
|
|
|
* @throws Exception on invalid argument type. |
|
|
|
|
*/ |
|
|
|
|
public function setAssetManager($assetManager) |
|
|
|
|
{ |
|
|
|
@ -403,7 +404,7 @@ class AssetController extends Controller
|
|
|
|
|
$depends[] = $target; |
|
|
|
|
} |
|
|
|
|
$targets[$bundle] = Yii::createObject([ |
|
|
|
|
'class' => strpos($bundle, '\\') !== false ? $bundle : 'yii\\web\\AssetBundle', |
|
|
|
|
'class' => strpos($bundle, '\\') !== false ? $bundle : AssetBundle::class, |
|
|
|
|
'depends' => $depends, |
|
|
|
|
]); |
|
|
|
|
} |
|
|
|
@ -686,8 +687,8 @@ return [
|
|
|
|
|
// The list of asset bundles to compress: |
|
|
|
|
'bundles' => [ |
|
|
|
|
// 'app\assets\AppAsset', |
|
|
|
|
// 'yii\web\YiiAsset', |
|
|
|
|
// 'yii\web\JqueryAsset', |
|
|
|
|
// \yii\web\YiiAsset::class, |
|
|
|
|
// \yii\web\JqueryAsset::class, |
|
|
|
|
], |
|
|
|
|
// Asset bundle for compression output: |
|
|
|
|
'targets' => [ |
|
|
|
|