Skip to content

Commit d1f1252

Browse files
committed
Change the way the minify_exclude configurations can be used.
1 parent 83ada52 commit d1f1252

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

app/code/Magento/Store/etc/config.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
<merge_files>0</merge_files>
2222
<minify_files>0</minify_files>
2323
<minify_exclude>
24-
/tiny_mce/
24+
<tiny_mce>/tiny_mce/</tiny_mce>
2525
</minify_exclude>
2626
</js>
2727
<css>
2828
<minify_files>0</minify_files>
2929
<minify_exclude>
30-
/tiny_mce/
30+
<tiny_mce>/tiny_mce/</tiny_mce>
3131
</minify_exclude>
3232
</css>
3333
<image>

lib/internal/Magento/Framework/View/Asset/Minification.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,26 @@ public function getExcludes($contentType)
143143
if (!isset($this->configCache[self::XML_PATH_MINIFICATION_EXCLUDES][$contentType])) {
144144
$this->configCache[self::XML_PATH_MINIFICATION_EXCLUDES][$contentType] = [];
145145
$key = sprintf(self::XML_PATH_MINIFICATION_EXCLUDES, $contentType);
146-
foreach (explode("\n", $this->scopeConfig->getValue($key, $this->scope)) as $exclude) {
146+
$excludeValues = $this->getMinificationExcludeValues($key);
147+
foreach ($excludeValues as $exclude) {
147148
if (trim($exclude) != '') {
148149
$this->configCache[self::XML_PATH_MINIFICATION_EXCLUDES][$contentType][] = trim($exclude);
149150
}
150151
}
151152
}
152153
return $this->configCache[self::XML_PATH_MINIFICATION_EXCLUDES][$contentType];
153154
}
155+
156+
/**
157+
* Get minification exclude values from configuration
158+
*
159+
* @param string $key
160+
* @return string[]
161+
*/
162+
private function getMinificationExcludeValues($key)
163+
{
164+
$configValues = $this->scopeConfig->getValue($key, $this->scope) ?? [];
165+
166+
return array_values($configValues);
167+
}
154168
}

lib/internal/Magento/Framework/View/Test/Unit/Asset/MinificationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ public function testGetExcludes()
203203
->expects($this->once())
204204
->method('getValue')
205205
->with('dev/js/minify_exclude')
206-
->willReturn(
207-
" /tiny_mce/ \n" .
208-
" /tiny_mce2/ "
209-
);
206+
->willReturn([
207+
'tiny_mce' => '/tiny_mce/',
208+
'some_other_unique_name' => '/tiny_mce2/'
209+
]);
210210

211211
$expected = ['/tiny_mce/', '/tiny_mce2/'];
212212
$this->assertEquals($expected, $this->minification->getExcludes('js'));

0 commit comments

Comments
 (0)