Skip to content

Commit b254c1f

Browse files
author
Tanniru, Murali(mtanniru)
committed
Merge remote-tracking branch 'origin/MAGETWO-52766-GitHub-Template-Minification-4365' into pull-request
2 parents d8d3eaa + c111fc3 commit b254c1f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ public function testMinify()
124124
<head>
125125
<title>Test title</title>
126126
</head>
127+
<link rel="stylesheet" href='https://www.example.com/2' type="text/css" />
128+
<link rel="stylesheet" type="text/css" media="all" href="https://www.example.com/1" type="text/css" />
127129
<body>
128130
<a href="http://somelink.com/text.html">Text Link</a>
129131
<img src="test.png" alt="some text" />
@@ -149,14 +151,16 @@ public function testMinify()
149151
//]]>
150152
</script>
151153
<?php echo "http://some.link.com/" ?>
154+
<?php echo "//some.link.com/" ?>
155+
<?php echo '//some.link.com/' ?>
152156
<em>inline text</em>
153157
<a href="http://www.<?php echo 'hi' ?>"></a>
154158
</body>
155159
</html>
156160
TEXT;
157161

158162
$expectedContent = <<<TEXT
159-
<?php /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ ?> <?php ?> <html><head><title>Test title</title></head><body><a href="http://somelink.com/text.html">Text Link</a> <img src="test.png" alt="some text" /><?php echo \$block->someMethod(); ?> <div style="width: 800px" class="<?php echo \$block->getClass() ?>" /><script>
163+
<?php /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ ?> <?php ?> <html><head><title>Test title</title></head><link rel="stylesheet" href='https://www.example.com/2' type="text/css" /><link rel="stylesheet" type="text/css" media="all" href="https://www.example.com/1" type="text/css" /><body><a href="http://somelink.com/text.html">Text Link</a> <img src="test.png" alt="some text" /><?php echo \$block->someMethod(); ?> <div style="width: 800px" class="<?php echo \$block->getClass() ?>" /><script>
160164
var i = 1;
161165
var j = 1;
162166
@@ -174,7 +178,7 @@ public function testMinify()
174178
}
175179
});
176180
//]]>
177-
</script><?php echo "http://some.link.com/" ?> <em>inline text</em> <a href="http://www.<?php echo 'hi' ?>"></a></body></html>
181+
</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>
178182
TEXT;
179183

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

0 commit comments

Comments
 (0)