rmrevin/yii2-minify-view

Yii2 View component with minification css & js

1.13.0 2016-10-26 10:37 UTC

README

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

License Latest Stable Version Latest Unstable Version Total Downloads

Code Status

Scrutinizer Code Quality Code Coverage Travis CI Build Status Dependency Status

Support

GutHub issues or public chat.

Installation

The preferred way to install this extension is through composer.

Either run

composer require "rmrevin/yii2-minify-view:~1.13"

or add

"rmrevin/yii2-minify-view": "~1.13",

to the require section of your composer.json file.

Configure

<?php

return [
    // ...
    'components' => [
        // ...
        'view' => [
            'class' => '\rmrevin\yii\minify\View',
            'enableMinify' => !YII_DEBUG,
            'concatCss' => true, // concatenate css
            'minifyCss' => true, // minificate css
            'concatJs' => true, // concatenate js
            'minifyJs' => true, // minificate js
            'minifyOutput' => true, // minificate result html page
            'web_path' => '@web', // path alias to web base
            'base_path' => '@webroot', // path alias to web base
            'minify_path' => '@webroot/minify', // path alias to save minify result
            'js_position' => [ \yii\web\View::POS_END ], // positions of js files to be minified
            'force_charset' => 'UTF-8', // charset forcibly assign, otherwise will use all of the files found charset
            'expand_imports' => true, // whether to change @import on content
            'compress_options' => ['extra' => true], // options for compress
            'excludeBundles' => [
                \dev\hellowrld\AssetBundle::class, // exclude this bundle from minification
            ],
        ]
    ]
];