Same name and namespace in other branches
- 5.0.x advagg_ext_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_ext_minify\EventSubscriber\MinificationSubscriber::minifyJs()
- 6.0.x advagg_ext_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_ext_minify\EventSubscriber\MinificationSubscriber::minifyJs()
- 8.x-4.x advagg_ext_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_ext_minify\EventSubscriber\MinificationSubscriber::minifyJs()
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 63
Class
- MinificationSubscriber
- Subscribe to asset optimization events and minify assets.
Namespace
Drupal\advagg_ext_minify\EventSubscriberCode
public function minifyJs(AssetOptimizationEvent $asset) {
if (!$this->isEnabled('js')) {
return;
}
$content = $asset->getContent();
$content = $this->minifier
->js($content, $asset->getAsset(), $asset->getData());
$asset->setContent($content);
}