CssOptimizer::optimize

public CssOptimizer::optimize(array $css_asset)

Optimizes an asset.

Parameters

array $asset: An asset.

Return value

string The optimized asset's contents.

Overrides AssetOptimizerInterface::optimize

File

core/lib/Drupal/Core/Asset/CssOptimizer.php, line 22

Class

CssOptimizer
Optimizes a CSS asset.

Namespace

Drupal\Core\Asset

Code

public function optimize(array $css_asset) {
  if ($css_asset['type'] != 'file') {
    throw new \Exception('Only file CSS assets can be optimized.');
  }
  if (!$css_asset['preprocess']) {
    throw new \Exception('Only file CSS assets with preprocessing enabled can be optimized.');
  }

  return $this->processFile($css_asset);
}
doc_Drupal
2016-10-29 08:59:18
Comments
Leave a Comment

Please login to continue.