Cryden / oc-htmlminify-plugin

HTML minify plugin for October CMS
https://octobercms.com/plugin/dmitrybykov-htmlminify
MIT License
5 stars 7 forks source link

plugin not working #4

Open plyusninva opened 5 years ago

plyusninva commented 5 years ago

October Build 455 {% htmlcompress %} ... {% endhtmlcompress %} - Unknown "htmlcompress" tag. {{ content|markdown|htmlcompress }} - Unknown "htmlcompress" filter. {{ htmlcompress('some html') }} - Unknown "htmlcompress" function.

mrgswift commented 5 years ago

@plyusninva This is issue seems to be happening to me as well on my staging environment, but not my dev environment (weird). So far after doing some debugging I can conclude that Event::listen('cms.page.beforeRenderPage',...) is never firing, which is why it is not registering the vendor dependency. I am also using Build 455.

mrgswift commented 5 years ago

I don't have time to figure out why Event::listen('cms.page.beforeRenderPage',...) isn't working in Plugin.php, but I found a temporary fix that makes the plugin work for now.

I changed the event listener in my boot function in Plugin.php to:

        Event::listen('cms.page.beforeDisplay', function($controller, $page){
            $twig = $controller->getTwig();
            $twig->addExtension(new Extension(true));
        });

This appears to fix the problem for now (html is minified correctly) until I figure out why the original Event::listen('cms.page.beforeRenderPage',...) listener isn't firing.

grigkar commented 4 years ago

I don't have time to figure out why Event::listen('cms.page.beforeRenderPage',...) isn't working in Plugin.php, but I found a temporary fix that makes the plugin work for now.

I changed the event listener in my boot function in Plugin.php to:

        Event::listen('cms.page.beforeDisplay', function($controller, $page){
            $twig = $controller->getTwig();
            $twig->addExtension(new Extension(true));
        });

This appears to fix the problem for now (html is minified correctly) until I figure out why the original Event::listen('cms.page.beforeRenderPage',...) listener isn't firing.

It doesn't work for me. Have you found the origin of problem?