Skip to content

Commit 66aee7d

Browse files
committed
MAGETWO-50673: Static asset deployment is crazy slow with multiple locales
- MAGETWO-54821: Non executing minification and bundling if they are no activated
1 parent 57b7287 commit 66aee7d

File tree

3 files changed

+3
-26
lines changed

3 files changed

+3
-26
lines changed

app/code/Magento/Deploy/Model/Deployer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public function deploy(ObjectManagerFactory $omFactory, array $deployableLanguag
315315
}
316316
}
317317
}
318-
if (!$this->getOption(Options::HTML_MINIFY_OPTION) && $this->getAssetConfig()->isMinifyHtml()) {
318+
if (!($this->getOption(Options::HTML_MINIFY_OPTION) ?: !$this->getAssetConfig()->isMinifyHtml())) {
319319
$this->output->writeln('=== Minify templates ===');
320320
$this->count = 0;
321321
foreach ($this->filesUtil->getPhtmlFiles(false, false) as $template) {

lib/internal/Magento/Framework/View/Asset/Bundle/Manager.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ protected function splitPath($path)
179179
*/
180180
public function addAsset(LocalInterface $asset)
181181
{
182-
if (!$this->assetConfig->isBundlingJsFiles() || !$this->isValidAsset($asset)) {
182+
if (!$this->isValidAsset($asset)) {
183183
return false;
184184
}
185185

@@ -250,8 +250,6 @@ protected function isValidType(LocalInterface $asset)
250250
*/
251251
public function flush()
252252
{
253-
if ($this->assetConfig->isBundlingJsFiles()) {
254-
$this->bundle->flush();
255-
}
253+
$this->bundle->flush();
256254
}
257255
}

lib/internal/Magento/Framework/View/Test/Unit/Asset/Bundle/ManagerTest.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ protected function setUp()
7070

7171
public function testAddAssetWithInvalidType()
7272
{
73-
$this->assetConfig->expects(self::once())->method('isBundlingJsFiles')->willReturn(true);
7473
$this->asset->expects($this->once())
7574
->method('getContentType')
7675
->willReturn('testType');
@@ -80,7 +79,6 @@ public function testAddAssetWithInvalidType()
8079

8180
public function testAddAssetWithExcludedFile()
8281
{
83-
$this->assetConfig->expects(self::once())->method('isBundlingJsFiles')->willReturn(true);
8482
$dirRead = $this->getMockBuilder(\Magento\Framework\Filesystem\Directory\ReadInterface::class)
8583
->disableOriginalConstructor()
8684
->getMock();
@@ -124,7 +122,6 @@ public function testAddAssetWithExcludedFile()
124122

125123
public function testAddAssetWithExcludedDirectory()
126124
{
127-
$this->assetConfig->expects(self::once())->method('isBundlingJsFiles')->willReturn(true);
128125
$dirRead = $this->getMockBuilder(\Magento\Framework\Filesystem\Directory\ReadInterface::class)
129126
->disableOriginalConstructor()
130127
->getMock();
@@ -177,7 +174,6 @@ public function testAddAssetWithExcludedDirectory()
177174

178175
public function testAddAsset()
179176
{
180-
$this->assetConfig->expects(self::once())->method('isBundlingJsFiles')->willReturn(true);
181177
$dirRead = $this->getMockBuilder(\Magento\Framework\Filesystem\Directory\ReadInterface::class)
182178
->disableOriginalConstructor()
183179
->getMock();
@@ -221,27 +217,10 @@ public function testAddAsset()
221217
$this->assertTrue($this->manager->addAsset($this->asset));
222218
}
223219

224-
public function testDoNotAddAssetIfBundlingDisabled()
225-
{
226-
$this->assetConfig->expects(self::once())->method('isBundlingJsFiles')->willReturn(false);
227-
$this->asset->expects(self::never())->method('getContentType');
228-
229-
$this->manager->addAsset($this->asset);
230-
}
231-
232220
public function testFlush()
233221
{
234-
$this->assetConfig->expects(self::once())->method('isBundlingJsFiles')->willReturn(true);
235222
$this->bundle->expects($this->once())
236223
->method('flush');
237224
$this->manager->flush();
238225
}
239-
240-
public function testDoNoFlushIfBundlingDisabled()
241-
{
242-
$this->assetConfig->expects(self::once())->method('isBundlingJsFiles')->willReturn(false);
243-
$this->bundle->expects(self::never())->method('flush');
244-
245-
$this->manager->flush();
246-
}
247226
}

0 commit comments

Comments
 (0)