as-milano/yii2-minify

Yii2 View component with minification css & js

Installs: 338

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:yii2-extension

dev-master 2016-02-04 16:48 UTC

This package is auto-updated.

Last update: 2024-03-29 03:07:20 UTC


README

The main feature of this component - concatenate and compress files connected through "AssetBundle".

Fork of another extension with some additional features:

  • Ability to just concatenate files (without compression);
  • Ability to choose between fast and safe methods of checking that original file was changed.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist as-milano/yii2-minify "*"

or add

"as-milano/yii2-minify": "*"

to the require section of your composer.json file.

Configure

In the application configuration add configuration for the View component:

'components' => [
    // ...
    'view' => [
        'class' => 'milano\minify\View',
        'enableMinify' => !YII_DEBUG,
        'minifyCss' => true,
        'compressCss' => true,
        'minifyJs' => true,
        'compressJs' => true,
        'minifyPath' => '@webroot/assets/minify',
        'jsPosition' => [\yii\web\View::POS_END],
        'expandImports' => true,
        'compressOutput' => true,
        'hashMethod' => 'sha'
    ]
    // ...
]