You are here

public function CSSCompression_Compress::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/Compress.inc \CSSCompression_Compress::compress()

Centralized function to run css compression.

Parameters

(string) css: Stylesheet to compresss:

File

advagg_css_compress/css-compressor-3.x/src/lib/Compress.inc, line 75

Class

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

Code

public function compress($css) {
  $setup = $this
    ->setup($css);
  $setup = $this
    ->rulesets($setup);
  $css = $this
    ->readability($setup);

  // Attach plea to top of page with unknown blocks
  if ($this->options['add-unknown'] && count($setup['unknown'])) {
    $css = "/*\nThere are unknown blocks in the sheet, please please please open an issue with your sheet attached to it:\n" . "https://github.com/codenothing/css-compressor/issues\n" . "Thank You --\n\n" . implode("\n", $setup['unknown']) . "\n*/\n" . $css;
  }

  // Mark final file size
  $this->stats['after']['size'] = strlen($css = trim($css));

  // Return compressed css
  return $css;
}