You are here

public function Minifier::__construct in Advanced CSS/JS Aggregation 8.4

Same name and namespace in other branches
  1. 8.3 advagg_ext_minify/src/Asset/Minifier.php \Drupal\advagg_ext_minify\Asset\Minifier::__construct()

Construct the optimizer instance.

Parameters

string $root: Gets the app root.

\Psr\Log\LoggerInterface $logger: The logger service.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: A config factory for retrieving required config objects.

\Drupal\Core\File\FileSystemInterface $file: The filesystem service.

Overrides SingleAssetOptimizerBase::__construct

File

advagg_ext_minify/src/Asset/Minifier.php, line 55

Class

Minifier
Optimizes a asset via external minifiers.

Namespace

Drupal\advagg_ext_minify\Asset

Code

public function __construct(string $root, LoggerInterface $logger, ConfigFactoryInterface $config_factory, FileSystemInterface $file) {
  parent::__construct($logger);
  $this->config = $config_factory
    ->get('advagg_ext_minify.settings');
  $this->file = $file;
  $this->in = $file
    ->realpath($file
    ->tempnam('public://js/optimized', 'advagg_in'));
  $this->out = $file
    ->realpath($file
    ->tempnam('public://js/optimized', 'advagg_out'));
  $this->root = $root;
}