Skip to content

Commit 3ee3850

Browse files
author
Cari Spruiell
committed
MAGETWO-52766: [Github] Template Minification is broken on the front-end #4365
- correct regex to allow for "// and '// patterns
1 parent a5fa3af commit 3ee3850

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/internal/Magento/Framework/View/Template/Html/Minifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function minify($file)
131131
'#(?<!:|\\\\|\'|")//(?!\s*\<\!\[)(?!\s*]]\>)[^\n\r]*#',
132132
'',
133133
preg_replace(
134-
'#(?<!:)//[^\n\r]*(\s\?\>)#',
134+
'#(?<!:|\'|")//[^\n\r]*(\s\?\>)#',
135135
'$1',
136136
preg_replace(
137137
'#(?<!:)//[^\n\r]*(\<\?php)[^\n\r]*(\s\?\>)[^\n\r]*#',

lib/internal/Magento/Framework/View/Test/Unit/Template/Html/MinifierTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ public function testMinify()
149149
//]]>
150150
</script>
151151
<?php echo "http://some.link.com/" ?>
152+
<?php echo "//some.link.com/" ?>
153+
<?php echo '//some.link.com/' ?>
152154
<em>inline text</em>
153155
<a href="http://www.<?php echo 'hi' ?>"></a>
154156
</body>
@@ -174,7 +176,7 @@ public function testMinify()
174176
}
175177
});
176178
//]]>
177-
</script><?php echo "http://some.link.com/" ?> <em>inline text</em> <a href="http://www.<?php echo 'hi' ?>"></a></body></html>
179+
</script><?php echo "http://some.link.com/" ?> <?php echo "//some.link.com/" ?> <?php echo '//some.link.com/' ?> <em>inline text</em> <a href="http://www.<?php echo 'hi' ?>"></a></body></html>
178180
TEXT;
179181

180182
$this->appDirectoryMock->expects($this->once())

0 commit comments

Comments
 (0)