CssSubscriber.php in Advanced CSS/JS Aggregation 8.3
File
advagg_old_ie_compatibility/src/EventSubscriber/CssSubscriber.php
View source
<?php
namespace Drupal\advagg_old_ie_compatibility\EventSubscriber;
use Drupal\advagg\Asset\AssetOptimizationEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class CssSubscriber implements EventSubscriberInterface {
public function scan(AssetOptimizationEvent $asset) {
$asset_array = $asset
->getAsset();
$asset_array['selectors'] = substr_count($asset
->getContent(), '{');
$asset
->setAsset($asset_array);
}
public static function getSubscribedEvents() {
return [
AssetOptimizationEvent::CSS => [
'scan',
100,
],
];
}
}
Classes
Name |
Description |
CssSubscriber |
Subscribe to CSs asset optimization events and count selectors. |