public function MinificationSubscriber::minifyCss in Advanced CSS/JS Aggregation 8.3
Same name and namespace in other branches
- 8.4 advagg_ext_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_ext_minify\EventSubscriber\MinificationSubscriber::minifyCss()
Pass the minification over to the minification service.
Parameters
\Drupal\advagg\Asset\AssetOptimizationEvent $asset: The asset optimization event.
File
- advagg_ext_minify/
src/ EventSubscriber/ MinificationSubscriber.php, line 48
Class
- MinificationSubscriber
- Subscribe to asset optimization events and minify assets.
Namespace
Drupal\advagg_ext_minify\EventSubscriberCode
public function minifyCss(AssetOptimizationEvent $asset) {
if (!$this
->isEnabled('css')) {
return;
}
$content = $asset
->getContent();
$content = $this->minifier
->css($content, $asset
->getAsset(), $asset
->getData());
$asset
->setContent($content);
}