dimobelov / bludit-minify-html

Compress/minify the HTML output of a site built with Bludit.
https://plugins.bludit.com
0 stars 1 forks source link

Fix for Bludit v3.x #3

Open tiloschroeder opened 1 year ago

tiloschroeder commented 1 year ago

With Bludit 3.x, the plugin only minifies a few last lines of HTML code.

To be able to minify all HTML code, we need to start the output buffering via the beforeAll hook.

The following code for the plugin.php works fine for me:


<?php

class pluginMinifyHTML extends Plugin {

    public function init()
    {
        // Fields and default values for the database of this plugin
    }

    public function beforeAll()
    {
        ob_start();
    }

    public function afterAll()
    {
        require_once('class-minify-html.php');
        $buffer = ob_get_clean();

        echo Minify_HTML::minify($buffer);

    }

}
bitscoper commented 1 year ago

Also works for me, thanks a lot @tiloschroeder. @dimobelov, please fix it.