public function cssMin($cssText = "") { if ($this->shouldMinify) { $cssText = \Minify_CSSmin::minify($cssText); } return $cssText; }
/** * Minify CSS * * @param string $cssContent * @param bool $fileUri * @param array $importUrl * * @return bool|string */ public static function minifyCSS($cssContent, $fileUri = false, &$importUrl = array()) { Media::$current_css_file = $fileUri; if (strlen($cssContent) > 0) { $cssContent = \Minify_CSSmin::minify($cssContent); $limit = Media::getBackTrackLimit(); $cssContent = preg_replace_callback(Media::$pattern_callback, array('Media', 'replaceByAbsoluteURL'), $cssContent, $limit); $cssContent = str_replace('\'images_ie/', '\'images/', $cssContent); $cssContent = preg_replace_callback('#(AlphaImageLoader\\(src=\')([^\']*\',)#s', array('Tools', 'replaceByAbsoluteURL'), $cssContent); // Store all import url preg_match_all('#@(import|charset) .*?;#i', $cssContent, $m); for ($i = 0, $total = count($m[0]); $i < $total; $i++) { if (isset($m[1][$i]) && $m[1][$i] == 'import') { $importUrl[] = $m[0][$i]; } $cssContent = str_replace($m[0][$i], '', $cssContent); } return trim($cssContent); } return false; }