You are here

public function CSSCompression_Control::compress in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 6 advagg_css_compress/css-compressor-3.x/src/lib/Control.inc \CSSCompression_Control::compress()

Proxy to run Compression on the sheet passed. Handle options here.

Parameters

(string) css: Stylesheet to be compressed:

(mixed) options: Array of options or mode to use.:

File

advagg_css_compress/css-compressor-3.x/src/lib/Control.inc, line 184

Class

CSSCompression_Control
CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com

Code

public function compress($css = NULL, $options = NULL) {

  // Flush out old stats and variables
  $this
    ->flush();

  // If no additional options, just run compression
  if ($options === NULL) {
    return $this->css = $this->Compress
      ->compress($css);
  }

  // Store old params
  $old = $this->mode == '__custom' ? $this->Option
    ->option() : $this->mode;
  $readability = $this->Option
    ->option('readability');

  // Compress with new set of options
  $this->Option
    ->merge($options);
  $css = $this->Compress
    ->compress($css);

  // Reset original options
  $this
    ->reset();
  $this->Option
    ->merge($old);

  // Return the compressed css
  return $this->css = $css;
}