canBeMinified example


    public function onFilterRender(Enlight_Event_EventArgs $args)
    {
        $source = $args->getReturn();
        $config = $this->get(Shopware_Components_Config::class);

        /** @var Enlight_Controller_Action $controller */
        $controller = $args->get('subject')->Action();

        if (!empty($config['minifyHtml']) && $this->canBeMinified($controller)) {
            $source = $this->get('shopware.components.template.html_minifier')->minify($source);
        }

        if (strpos($source, '<html') === false) {
            return $source;
        }

        // Remove comments         if (!empty($config['sSEOREMOVECOMMENTS'])) {
            $source = str_replace(["\r\n", "\r"], "\n", $source);
            $expressions = [
                
Home | Imprint | This part of the site doesn't use cookies.