rmrevin/yii2-minify-view Yii2 View component with auto minification css & js in runtime

minifyviewjscss

Yii 2 Minify View Component

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

or add

"rmrevin/yii2-minify-view": "^1.15",

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
            'webPath' => '@web', // path alias to web base
            'basePath' => '@webroot', // path alias to web base
            'minifyPath' => '@webroot/minify', // path alias to save minify result
            'jsPosition' => [ \yii\web\View::POS_END ], // positions of js files to be minified
            'forceCharset' => 'UTF-8', // charset forcibly assign, otherwise will use all of the files found charset
            'expandImports' => true, // whether to change @import on content
            'compressOptions' => ['extra' => true], // options for compress
            'excludeFiles' => [
                'jquery.js', // exclude this file from minification
                'app-[^.].js', // you may use regexp
            ],
            'excludeBundles' => [
                \app\helloworld\AssetBundle::class, // exclude this bundle from minification
            ],
        ]
    ]
];

Changelog

2017-06-09 - 1.15.1

  • Update cssmin package to version 4

2017-05-31 - 1.15.0

  • Update minify package to version 3

2017-01-19 - 1.14.4

  • Changed the regular expression when checking the excluded files.

2017-01-19 - 1.14.3

  • Disable ssl verification in expand css imports.

2017-01-19 - 1.14.2

  • Add jsOptions option.

2016-12-23 - 1.14.1

  • Improved mechanism exclude files from minification.
  • Update readme.

2016-12-23 - 1.14.0

  • Improved mechanism exclude files from minification.
  • Refactoring.
  • Update readme.

2016-10-26 - 1.13.0

  • Property rmrevin\yii\minify\View::$compress_output is now deprecated. User rmrevin\yii\minify\View::$minifyOutput.
  • Enhancement #44: property rmrevin\yii\minify\View::$enableMinify now affects the output minify.
  • Update readme.

2016-08-21 - 1.12.2

  • Added missed asset manager appendTimestamp param.

2016-08-03 - 1.12.0

  • Enhancement #38 (add excludeBundles param).
  • Bugfix #39.

2016-06-22 - 1.11.0

  • Enhancement #35.
  • Bugfix #36.

2016-06-06 - 1.10.2

  • Bugfix #32.

2016-05-23 - 1.10.1

  • Bugfix.
  • Refactoring.

2016-05-22 - 1.10.0

  • Add fileCheckAlgorithm property.

2015-08-20 - 1.9.4

  • Content are no longer compressed inside textarea.
  • In View added new property compress_options.

2015-08-20 - 1.9.3

  • Refactoring.

2015-08-20 - 1.9.2

  • Refactoring.

2015-08-20 - 1.9.1

  • Added deleting comments in css.
  • Refactoring.

2015-07-22 - 1.9.0

  • Improved handling of conditional comments.
  • Improved the order dependency in the case file inclusion through cdn.
  • Refactoring.

2015-06-19 - 1.8.6

  • Refactoring.

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



2.0.0 is the latest of 56 releases



MIT license
Stats
191 github stars & 68 github forks
147 downloads in the last day
2797 downloads in the last 30 days
225682 total downloads