Backend\Core\Engine\Header::minifyCSS PHP Method

minifyCSS() private method

Minify a CSS-file
private minifyCSS ( string $file ) : string
$file string The file to be minified.
return string
    private function minifyCSS($file)
    {
        // create unique filename
        $fileName = md5($file) . '.css';
        $finalURL = BACKEND_CACHE_URL . '/MinifiedCss/' . $fileName;
        $finalPath = BACKEND_CACHE_PATH . '/MinifiedCss/' . $fileName;
        // check that file does not yet exist or has been updated already
        if (!is_file($finalPath) || filemtime(PATH_WWW . $file) > filemtime($finalPath)) {
            // minify the file
            $css = new Minify\CSS(PATH_WWW . $file);
            $css->minify($finalPath);
        }
        return $finalURL;
    }