Yii 2.0: yii2-html-compressor-filter

A filter that compresses HTML.
3 followers

A filter that compresses HTML. It also compresses CSS.

Demo

Click here for the demo. If you check the source code you will see that it is compressed.

Requirements

Yii 2.x

Usage

Copy HtmlCompressorFilter.php to the filters directory (create it if it doesn't exist).

Add an entry to the behaviors array:

public function behaviors()
    {
        return [
        [
        'class' => 'app\filters\HtmlCompressorFilter',
        ],
        ];
    }

Filter only applies when YII_DEBUG == false.

Donations

Donations are welcome. Thanks for your support!!!

Paypal

Total 2 comments

#19687 report it
oligalma at 2015/12/12 02:20am
re: zelenin

Hi,

I'm sorry if I did something wrong, I'm quite new to Yii 2. In this case, what should I do to install it in a "composer" way?

thanks

#19686 report it
zelenin at 2015/12/11 10:54pm
...

Copy HtmlCompressorFilter.php to the filters directory (create it if it doesn't exist). are you kidding me?) where is a composer package? You wrote yet another Spaceless widget https://github.com/yiisoft/yii2/blob/master/framework/widgets/Spaceless.php

Leave a comment

Please to leave your comment.

Create extension