private function minifyCSS($input)
  {
    $keepComments = null;
    $output = $this->stashComments( $input );

    // Remove Comments, preserving comments marked as important
    $output = preg_replace('!/\*[^*\!]*\*+([^/][^*]*\*+)*/!', '', $output);

    $output = $this->minifySpaceCSS($output);

    $output = $this->shortenHex($output);

    // Replace common units after 0's - they aren't needed
    $output = preg_replace('/((?<!\\\\)\:|\s)\-?0(?:em|cm|mm|in|px|pt|%)/iS', '${1}0', $output);

    // Remove Leading Zeros in Floats
    $output = preg_replace("/0\.([0-9]+)/", '.$1', $output);

    // Extra whitespace
    $output = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $output);

    // Add line breaks around remaining comments
    $output = $this->retrieveComments( $output );

    return $output;
  }
private function minifyCSS($input)
  {
    $keepComments = null;
    $output = $this->stashComments( $input );

    // Remove Comments, preserving comments marked as important
    $output = preg_replace('!/\*[^*\!]*\*+([^/][^*]*\*+)*/!', '', $output);

    $output = $this->minifySpaceCSS($output);

    $output = $this->shortenHex($output);

    // Replace common units after 0's - they aren't needed
    $output = preg_replace('/((?<!\\\\)\:|\s)\-?0(?:em|cm|mm|in|px|pt|%)/iS', '${1}0', $output);

    // Remove Leading Zeros in Floats
    $output = preg_replace("/0\.([0-9]+)/", '.$1', $output);

    // Extra whitespace
    $output = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $output);

    // Add line breaks around remaining comments
    $output = $this->retrieveComments( $output );

    return $output;
  }
private function minifyCSS ( $ input ) { $ keepComments = null ; $ output = $ this -> stashComments ( $ input ) ; // Remove Comments, preserving comments marked as important $ output = preg_replace ( '!/\*[^*\!]*\*+([^/][^*]*\*+)*/!' , '' , $ output ) ; $ output = $ this -> minifySpaceCSS ( $ output ) ; $ output = $ this -> shortenHex ( $ output ) ; // Replace common units after 0's - they aren't needed $ output = preg_replace ( '/((?<!\\\\)\:|\s)\-?0(?:em|cm|mm|in|px|pt|%)/iS' , '${1}0' , $ output ) ; // Remove Leading Zeros in Floats $ output = preg_replace ( "/0\.([0-9]+)/" , '.$1' , $ output ) ; // Extra whitespace $ output = str_replace ( array ( "\r\n" , "\r" , "\n" , "\t" , '  ' , '    ' , '    ' ) , '' , $ output ) ; // Add line breaks around remaining comments $ output = $ this -> retrieveComments ( $ output ) ; return $ output ; }
Minify CSS by removing unneeded code.

Regex references from:
http://stackoverflow.com/questions/15195750/minify-compress-css-with-regex
http://stackoverflow.com/questions/2167793/how-to-convert-all-color-code-xxyyzz-to-shorter-3-character-version-xyz-of-who

@param  string $input  The string of CSS code to minify

@return string         The minified CSS code.
Minify CSS by removing unneeded code .