public function MinificationSubscriber::minify in Advanced CSS/JS Aggregation 8.4
Same name in this branch
- 8.4 advagg_css_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_css_minify\EventSubscriber\MinificationSubscriber::minify()
- 8.4 advagg_js_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_js_minify\EventSubscriber\MinificationSubscriber::minify()
- 8.4 advagg_bundler/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_bundler\EventSubscriber\MinificationSubscriber::minify()
Same name and namespace in other branches
- 8.3 advagg_css_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_css_minify\EventSubscriber\MinificationSubscriber::minify()
Pass the minification over to the minification service.
Parameters
\Drupal\advagg\Asset\AssetOptimizationEvent $asset: The asset optimization event.
File
- advagg_css_minify/
src/ EventSubscriber/ MinificationSubscriber.php, line 37
Class
- MinificationSubscriber
- Subscribe to asset optimization events and minify assets.
Namespace
Drupal\advagg_css_minify\EventSubscriberCode
public function minify(AssetOptimizationEvent $asset) {
$content = $asset
->getContent();
$content = $this->minifier
->optimize($content, $asset
->getAsset(), $asset
->getData());
$this->minifier
->addLicense($content, $asset
->getAsset()['data']);
$asset
->setContent($content);
}