Yii 2.0: yii2-assets-optimizer

Basic unifier and compressor for CSS and JS files inside your Yii2 AssetBundles.
1 follower

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.

View on github/slinstj.

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;

Be the first person to leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet