diff --git a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php
index 80f6fcbfc1b54..6723d3909798d 100644
--- a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php
+++ b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php
@@ -375,12 +375,12 @@ protected function getAssetTemplate($contentType, $attributes)
{
switch ($contentType) {
case 'js':
- $groupTemplate = '' . "\n";
+ $groupTemplate = preg_replace('/\s+/', ' ', '') . "\n";
break;
case 'css':
default:
- $groupTemplate = '' . "\n";
+ $groupTemplate = preg_replace('/\s+/', ' ', '') . "\n";
break;
}
return $groupTemplate;
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php
index d28358e177d07..fdff1c4acdeb0 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/RendererTest.php
@@ -427,40 +427,40 @@ public function dataProviderRenderAssets(): array
[
['type' => 'css', 'attributes' => '', 'condition' => null],
['type' => 'js', 'attributes' => 'attr="value"', 'condition' => null],
- '' . "\n"
- . '' . "\n"
- . '' . "\n"
+ '' . "\n"
+ . '' . "\n"
+ . '' . "\n"
],
[
['type' => 'js', 'attributes' => ['attr' => 'value'], 'condition' => 'lt IE 7'],
['type' => 'css', 'attributes' => 'attr="value"', 'condition' => null],
- '' . "\n"
+ '' . "\n"
. '' . "\n"
],
[
['type' => 'ico', 'attributes' => 'attr="value"', 'condition' => null],
['type' => 'css', 'attributes' => '', 'condition' => null],
- '' . "\n"
- . '' . "\n"
- . '' . "\n"
+ '' . "\n"
+ . '' . "\n"
+ . '' . "\n"
],
[
['type' => 'js', 'attributes' => '', 'condition' => null],
['type' => 'ico', 'attributes' => ['attr' => 'value'], 'condition' => null],
- '' . "\n"
- . '' . "\n"
- . '' . "\n"
+ '' . "\n"
+ . '' . "\n"
+ . '' . "\n"
],
[
['type' => 'non', 'attributes' => ['attr' => 'value'], 'condition' => null],
['type' => 'ico', 'attributes' => '', 'condition' => null],
- '' . "\n"
- . '' . "\n"
- . '' . "\n"
- ]
+ '' . "\n"
+ . '' . "\n"
+ . '' . "\n"
+ ],
];
}
@@ -506,7 +506,7 @@ public function testRenderAssetWithNoContentType() : void
->willReturn([$groupMockOne]);
$this->assertEquals(
- '' . "\n",
+ '' . "\n",
$this->renderer->renderAssets($this->renderer->getAvailableResultGroups())
);
}