Same name in other branches
  1. 6.0.x advagg_ext_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_ext_minify\EventSubscriber\MinificationSubscriber::minifyCss()
  2. 8.x-3.x advagg_ext_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_ext_minify\EventSubscriber\MinificationSubscriber::minifyCss()
  3. 8.x-4.x advagg_ext_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_ext_minify\EventSubscriber\MinificationSubscriber::minifyCss()

Pass the minification over to the minification service.

Paramètres

\Drupal\advagg\Asset\AssetOptimizationEvent $asset: The asset optimization event.

Fichier

advagg_ext_minify/src/EventSubscriber/MinificationSubscriber.php, line 48

Classe

MinificationSubscriber
Subscribe to asset optimization events and minify assets.

Namespace

Drupal\advagg_ext_minify\EventSubscriber

Code

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);
}