You are here

public function CSSCompression::__construct in Advanced CSS/JS Aggregation 6

Same name and namespace in other branches
  1. 7 advagg_css_compress/css-compressor-3.x/src/CSSCompression.inc \CSSCompression::__construct()

Builds the subclasses, runs the compression if css passed, and merges options

Parameters

(string) css: CSS to compress on initialization if needed:

(array) options: Array of preferences to override the defaults:

File

advagg_css_compress/css-compressor-3.x/src/CSSCompression.inc, line 216

Class

CSSCompression

Code

public function __construct($css = NULL, $options = NULL) {
  $this->Control = new CSSCompression_Control($this);

  // Autorun against css passed
  if ($css) {

    // Allow passing options/mode only
    if (is_array($css) || array_key_exists($css, self::$modes)) {
      $this->Control->Option
        ->merge($css);
    }
    else {
      $this->Control
        ->compress($css, $options);
    }
  }
  else {
    if ($options) {
      $this->Control->Option
        ->merge($options);
    }
  }
}