Same name in this branch
- 5.0.x advagg_bundler/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_bundler\EventSubscriber\MinificationSubscriber::minify()
- 5.0.x advagg_css_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_css_minify\EventSubscriber\MinificationSubscriber::minify()
Same name in other branches
- 6.0.x advagg_bundler/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_bundler\EventSubscriber\MinificationSubscriber::minify()
- 6.0.x advagg_css_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_css_minify\EventSubscriber\MinificationSubscriber::minify()
- 6.0.x advagg_js_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_js_minify\EventSubscriber\MinificationSubscriber::minify()
- 8.x-3.x advagg_bundler/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_js_minify\EventSubscriber\MinificationSubscriber::minify()
- 8.x-3.x advagg_css_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_css_minify\EventSubscriber\MinificationSubscriber::minify()
- 8.x-3.x advagg_js_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_js_minify\EventSubscriber\MinificationSubscriber::minify()
- 8.x-4.x advagg_bundler/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_bundler\EventSubscriber\MinificationSubscriber::minify()
- 8.x-4.x advagg_css_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_css_minify\EventSubscriber\MinificationSubscriber::minify()
- 8.x-4.x advagg_js_minify/src/EventSubscriber/MinificationSubscriber.php \Drupal\advagg_js_minify\EventSubscriber\MinificationSubscriber::minify()
Pass the minification over to the minification service.
Parameters
\Drupal\advagg\Asset\AssetOptimizationEvent $asset: The optimization event.
File
-
advagg_js_minify/
src/ EventSubscriber/ MinificationSubscriber.php, line 37
Class
- MinificationSubscriber
- Subscribe to asset optimization events and minify assets.
Namespace
Drupal\advagg_js_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);
}