Giter Club home page Giter Club logo

yii2-assets-auto-compress's Introduction

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

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

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

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

How to use

//App config
[
    'bootstrap'    => ['assetsAutoCompress'],
    'components'    =>
    [
    //....
        'assetsAutoCompress' =>
        [
            'class'         => '\lexing2008\yii2AssetsAutoCompress\AssetsAutoCompressComponent',
        ],
    //....
    ]
]
//App config with all options
[
    'bootstrap'  => ['assetsAutoCompress'],
    'components' => [
        //....
        'assetsAutoCompress' => [
            'class'   => \lexing2008\yii2AssetsAutoCompress\AssetsAutoCompressComponent::class,
            'enabled' => true,
            'backendUrlFolder' => '/admin/', // папка backend. обязательно в //
            '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
            'cssFileCompileByGroups' => false       //Enables the compilation of files in groups rather than in a single file. Works only when the $cssFileCompile option is enabled
            '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
            'jsFileCompileByGroups'         => false        //Enables the compilation of files in groups rather than in a single file. Works only when the $jsFileCompile option is enabled
            '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

            'jsFilesExclude' => [ // исключает перечисленные js файлы из компиляции всех js файлов в один
                '/common/web/js/vue-app-scripts.js',
            ],

            'noIncludeJsFilesOnPjax' => true,        //Do not connect the js files when all pjax requests when all pjax requests when enabled jsFileCompile
            'noIncludeCssFilesOnPjax' => true,        //Do not connect the css files when all pjax requests when all pjax requests when enabled cssFileCompile

            'htmlFormatter' => [
                //Enable compression html
                'class'         => 'lexing2008\yii2AssetsAutoCompress\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' => 'lexing2008\yii2AssetsAutoCompress\formatters\html\MrclayHtmlCompressor',

                //or any other your handler implements lexing2008\yii2AssetsAutoCompress\assetsAuto\IFormatter interface

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

Links

Demo (view source code)

Screenshot

SkeekS CMS admin panel


SkeekS CMS admin panel


SkeekS CMS admin panel


SkeekS CMS admin panel


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

yii2-assets-auto-compress's People

Contributors

dimetriy avatar haifahrul avatar lexing2008 avatar ovidiupop avatar romanitalian avatar simocheccoli avatar skeeks-semenov avatar tsanchev avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.