defyma/yii2-minifier

Yii 2 Minifier

1.2.5 2021-02-05 16:33 UTC

This package is auto-updated.

Last update: 2024-05-05 23:36:49 UTC


README

This minifier using https://github.com/mrclay/minify, and integrated for yii2

Install With Composer

php composer.phar require defyma/yii2-minifier:"v1.*.*"

Or Require it

"defyma/yii2-minifier": "v1.*.*"

How To Use

  1. Add <?php \defyma\helper\Minifier::begin(); ?> and <?php \defyma\helper\Minifier::end(); ?> in Layout or View

Example

layout/main.php

    
    <!-- Minifier Begin -->
    <?php \defyma\helper\Minifier::begin(); ?>
    
    <?php $this->beginPage() ?>
    
    <!DOCTYPE html>
    <html lang="<?= Yii::$app->language ?>">
        <head>
            <!--
            // Content Head
            -->
        </head>
        <body>
            <?php $this->beginBody() ?>
    
            <!--
            // Content Body
            -->
    
            <?php $this->endBody() ?>
        </body>
    </html>
    
    <?php $this->endPage() ?>
    
    <?php \defyma\helper\Minifier::end(); ?>
     <!-- Minifier END -->

Library used

To Use Custom Library please refer to @vendor\defyma\yii2-minifier\Minifier.php.