public function testReduceHasRightReturn() { $this->assertEquals("test", $this->stub->reduce("test/../test")); }
/** * Simple home-made CSS minifier * * @param string $css The CSS code * * @return string The minified CSS code */ static function minify($css) { $css = str_replace(array("\r\n", "\r", "\n", "\t"), "", $css); // whitespace $css = preg_replace("/\\s+/", " ", $css); // multiple spaces $css = preg_replace("!/\\*[^*]*\\*+([^/][^*]*\\*+)*/!", "", $css); // comments $css = preg_replace("/\\s*([\\{\\};:,>])\\s*/", "\$1", $css); // whitespace around { } ; : , > $css = str_replace(";}", "}", $css); // ;} >> } $css = str_replace("/./", "/", $css); // /./ >> / $css = CMbPath::reduce($css); // foo/../ >> / //$css = preg_replace("/#([0-9A-F])\\1([0-9A-F])\\2([0-9A-F])\\3/i", "#\\1\\2\\3", $css); // Reduce #6699FF to #69F return $css; }