Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Minify.php
Go to the documentation of this file.
1 <?php
7 
12 
16 class Minify implements PreProcessorInterface
17 {
21  protected $adapter;
22 
26  protected $minification;
27 
33  {
34  $this->adapter = $adapter;
35  $this->minification = $minification;
36  }
37 
44  public function process(PreProcessor\Chain $chain)
45  {
46  if ($this->minification->isEnabled(pathinfo($chain->getTargetAssetPath(), PATHINFO_EXTENSION)) &&
47  $this->minification->isMinifiedFilename($chain->getTargetAssetPath()) &&
48  !$this->minification->isMinifiedFilename($chain->getOrigAssetPath())
49  ) {
50  $content = $this->adapter->minify($chain->getContent());
51  $chain->setContent($content);
52  }
53  }
54 }
process(PreProcessor\Chain $chain)
Definition: Minify.php:44
__construct(AdapterInterface $adapter, Minification $minification)
Definition: Minify.php:32