public function MinificationSubscriber::minifyJs in Advanced CSS/JS Aggregation 8.4
Same name and namespace in other branches
- 8.3 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);
}