getCompressJs example

$settings = $this->service->getSystemConfiguration(
            AbstractQuery::HYDRATE_OBJECT
        );

        $javascriptFiles = $this->javascriptCollector->collectJavascriptFiles($template$shop);
        $content = '';
        foreach ($javascriptFiles as $jsFile) {
            $content .= file_get_contents($jsFile) . ";\n";
        }

        if ($settings->getCompressJs()) {
            $content = $this->jsCompressor->compress($content);
        }

        $file->fwrite($content);
        $file->flock(LOCK_UN);   // release the lock
        $file = null; // release file handles, else Windows still locks the file
        rename($this->pathResolver->getTmpJsFilePath($shop$timestamp)$this->pathResolver->getJsFilePath($shop$timestamp));
    }

    
Home | Imprint | This part of the site doesn't use cookies.