Yii 2 Assets Optimizer ¶
Basic unifier and compressor for CSS and JS files inside your Yii2 AssetBundles. Uses internal server cache to speed up all the process, reducing the time wasting.
Installation ¶
composer require "slinstj/yii2-assets-optimizer"
Configuration/Usage ¶
return [
// ...
'components' => [
// ...
'view' => [
'class' => '\slinstj\assets\optimizer\View',
]
]
];
Additional Options ¶
return [
// ...
'components' => [
// ...
'view' => [
'class' => '\slinstj\assets\optimizer\View',
'minify' => true, // Or '!YII_DEBUG' for example.
// Folder where optimized file(s) will be published in:
'publishPath' => '@webroot/yao',
// Web acessible url. Must be in accord to 'publishPath':
'publishUrl' => '@web/yao',
]
]
];
Next versions ¶
- Improve cache by using ChainedDependency - On change JS and CSS files, the optimized file(s) will be regenerated automatically. For now, you should clear the cache manually. Please, check this to know how: cache-flushing.
- Use events instead of the own View object;
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.