Skip to content

Commit 31fc1ce

Browse files
vkholoshenkoRoman Ganin
authored andcommitted
MAGETWO-32990: Add minification to publisher tool
1 parent 992d40d commit 31fc1ce

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

dev/tools/Magento/Tools/View/Deployer.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,31 @@ class Deployer
4747
/** @var int */
4848
private $errorCount;
4949

50+
/** @var \Magento\Framework\View\Asset\MinifyService */
51+
protected $minifyService;
52+
5053
/**
5154
* @param Files $filesUtil
5255
* @param Deployer\Log $logger
5356
* @param Version\StorageInterface $versionStorage
5457
* @param \Magento\Framework\Stdlib\DateTime $dateTime
58+
* @param \Magento\Framework\View\Asset\MinifyService $minifyService
5559
* @param bool $isDryRun
5660
*/
5761
public function __construct(
5862
Files $filesUtil,
5963
Deployer\Log $logger,
6064
Version\StorageInterface $versionStorage,
6165
\Magento\Framework\Stdlib\DateTime $dateTime,
66+
\Magento\Framework\View\Asset\MinifyService $minifyService,
6267
$isDryRun = false
6368
) {
6469
$this->filesUtil = $filesUtil;
6570
$this->logger = $logger;
6671
$this->versionStorage = $versionStorage;
6772
$this->dateTime = $dateTime;
6873
$this->isDryRun = $isDryRun;
74+
$this->minifyService = $minifyService;
6975
}
7076

7177
/**
@@ -193,6 +199,7 @@ private function deployFile($filePath, $area, $themePath, $locale, $module)
193199
$requestedPath,
194200
['area' => $area, 'theme' => $themePath, 'locale' => $locale, 'module' => $module]
195201
);
202+
$asset = $this->minifyService->getAssets([$asset], true)[0];
196203
$this->logger->logDebug("\tDeploying the file to '{$asset->getPath()}'", '.');
197204
if ($this->isDryRun) {
198205
$asset->getContent();

0 commit comments

Comments
 (0)