|
17 | 17 | use Magento\Framework\ObjectManagerInterface;
|
18 | 18 | use Magento\Framework\Translate\Js\Config as JsTranslationConfig;
|
19 | 19 | use Symfony\Component\Console\Output\OutputInterface;
|
| 20 | +use Magento\Framework\View\Asset\Minification; |
| 21 | +use Magento\Framework\App\ObjectManager; |
20 | 22 |
|
21 | 23 | /**
|
22 | 24 | * A service for deploying Magento static view files for production mode
|
@@ -74,6 +76,11 @@ class Deployer
|
74 | 76 | */
|
75 | 77 | private $alternativeSources;
|
76 | 78 |
|
| 79 | + /** |
| 80 | + * @var Minification |
| 81 | + */ |
| 82 | + private $minification; |
| 83 | + |
77 | 84 | /**
|
78 | 85 | * Constructor
|
79 | 86 | *
|
@@ -183,6 +190,9 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales)
|
183 | 190 | $dictionaryFileName = $this->jsTranslationConfig->getDictionaryFileName();
|
184 | 191 | $this->deployFile($dictionaryFileName, $area, $themePath, $locale, null);
|
185 | 192 | }
|
| 193 | + if ($this->getMinification()->isEnabled('js')) { |
| 194 | + $fileManager->createMinResolverAsset(); |
| 195 | + } |
186 | 196 | $fileManager->clearBundleJsPool();
|
187 | 197 | $this->bundleManager->flush();
|
188 | 198 | $this->output->writeln("\nSuccessful: {$this->count} files; errors: {$this->errorCount}\n---\n");
|
@@ -213,6 +223,21 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales)
|
213 | 223 | return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
|
214 | 224 | }
|
215 | 225 |
|
| 226 | + /** |
| 227 | + * Get Minification instance |
| 228 | + * |
| 229 | + * @deprecated |
| 230 | + * @return Minification |
| 231 | + */ |
| 232 | + private function getMinification() |
| 233 | + { |
| 234 | + if (null === $this->minification) { |
| 235 | + $this->minification = ObjectManager::getInstance()->get(Minification::class); |
| 236 | + } |
| 237 | + |
| 238 | + return $this->minification; |
| 239 | + } |
| 240 | + |
216 | 241 | /**
|
217 | 242 | * Accumulate all static view files in the application and record all found areas, themes and languages
|
218 | 243 | *
|
|
0 commit comments