Esempio n. 1
0
 public function generateCSSFile()
 {
     /*if (!is_file(dirname(__FILE__).'/cache/stylesheet.php')) {*/
     $css = $this->generateCSS();
     include_once dirname(__FILE__) . '/classes/minify.php';
     $minifyCCS = new MinifyCSS($css);
     $minifyCCS->minify(dirname(__FILE__) . '/cache/stylesheet.php', $stripComments = true, $stripWhitespace = true, $shortenHex = true, $combineImports = true, $importFiles = true);
     /*}*/
     return DIR_WS_HTTP_CATALOG . DIR_WS_MODULES . 'checkout/cache/stylesheet.php';
 }
Esempio n. 2
0
 /**
  * Minify a CSS-file
  *
  * @param string $file The file to be minified.
  * @return string
  */
 private function minifyCSS($file)
 {
     // create unique filename
     $fileName = md5($file) . '.css';
     $finalURL = FRONTEND_CACHE_URL . '/minified_css/' . $fileName;
     $finalPath = FRONTEND_CACHE_PATH . '/minified_css/' . $fileName;
     // check that file does not yet exist or has been updated already
     if (!SpoonFile::exists($finalPath) || filemtime(PATH_WWW . $file) > filemtime($finalPath)) {
         // create directory if it does not exist
         if (!SpoonDirectory::exists(dirname($finalPath))) {
             SpoonDirectory::create(dirname($finalPath));
         }
         // minify the file
         require_once PATH_LIBRARY . '/external/minify.php';
         $css = new MinifyCSS(PATH_WWW . $file);
         $css->minify($finalPath);
     }
     return $finalURL;
 }