yii2-assets-auto-compress Expansion allows you to combine and optimize js and css files. Dynamically.

Automatically compile and merge files js + css + html in yii2 project.

  1. Installation
  2. How to use
  3. Links
  4. Demo (view source code)

This solution enables you to dynamically combine js and css files to optimize the html page. This allows you to improve the performance of google page speed.

This tool only works on real sites. On the local projects is not working!

Latest Stable Version Total Downloads Reference Status Dependency Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist skeeks/yii2-assets-auto-compress "*"

or add

"skeeks/yii2-assets-auto-compress": "*"

How to use

//App config
[
    'bootstrap'    => ['assetsAutoCompress'],
    'components'    =>
    [
    //....
        'assetsAutoCompress' =>
        [
            'class'         => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent',
        ],
    //....
    ]
]

//App config with all options
[
    'bootstrap'    => ['assetsAutoCompress'],
    'components'    =>
    [
    //....
        'assetsAutoCompress' =>
        [
            'class'                         => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent',
            'enabled'                       => true,
            
            'readFileTimeout'               => 3,           //Time in seconds for reading each asset file
            
            'jsCompress'                    => true,        //Enable minification js in html code
            'jsCompressFlaggedComments'     => true,        //Cut comments during processing js
            
            'cssCompress'                   => true,        //Enable minification css in html code
            
            'cssFileCompile'                => true,        //Turning association css files
            'cssFileRemouteCompile'         => false,       //Trying to get css files to which the specified path as the remote file, skchat him to her.
            'cssFileCompress'               => true,        //Enable compression and processing before being stored in the css file
            'cssFileBottom'                 => false,       //Moving down the page css files
            'cssFileBottomLoadOnJs'         => false,       //Transfer css file down the page and uploading them using js
            
            'jsFileCompile'                 => true,        //Turning association js files
            'jsFileRemouteCompile'          => false,       //Trying to get a js files to which the specified path as the remote file, skchat him to her.
            'jsFileCompress'                => true,        //Enable compression and processing js before saving a file
            'jsFileCompressFlaggedComments' => true,        //Cut comments during processing js
            
            
            'noIncludeJsFilesOnPjax'        => true,        //Do not connect the js files when all pjax requests
            
            
            'htmlFormatter' => [
                //Enable compression html
                'class'         => 'skeeks\yii2\assetsAuto\formatters\html\TylerHtmlCompressor',
                'extra'         => false,       //use more compact algorithm
                'noComments'    => true,        //cut all the html comments
                'maxNumberRows' => 50000,       //The maximum number of rows that the formatter runs on

                //or

                'class' => 'skeeks\yii2\assetsAuto\formatters\html\MrclayHtmlCompressor',

                //or any other your handler implements skeeks\yii2\assetsAuto\IFormatter interface

                //or false
            ],
        ],
    //....
    ]
]

Links

Demo (view source code)

skeeks!
SkeekS CMS (Yii2) — fast, simple, effective!
skeeks.com | cms.skeeks.com

4 0
11 followers
0 downloads
Yii Version: 2.0.*
License: BSD-3-Clause
Category: Web Service
Developed by: skeeks
Created on: Aug 7, 2015
Last updated: 2 months ago
Github Repository

Related Extensions