mirror of
https://github.com/mrclay/minify.git
synced 2025-08-08 23:26:43 +02:00
CSS/Compressor.php : Issue 107 fix
This commit is contained in:
@@ -176,6 +176,7 @@ class Minify_CSS_Compressor {
|
|||||||
*/
|
*/
|
||||||
protected function _commentCB($m)
|
protected function _commentCB($m)
|
||||||
{
|
{
|
||||||
|
$hasSurroundingWs = (trim($m[0]) !== $m[1]);
|
||||||
$m = $m[1];
|
$m = $m[1];
|
||||||
// $m is the comment content w/o the surrounding tokens,
|
// $m is the comment content w/o the surrounding tokens,
|
||||||
// but the return value will replace the entire comment.
|
// but the return value will replace the entire comment.
|
||||||
@@ -219,7 +220,11 @@ class Minify_CSS_Compressor {
|
|||||||
$this->_inHack = false;
|
$this->_inHack = false;
|
||||||
return '/**/';
|
return '/**/';
|
||||||
}
|
}
|
||||||
return ''; // remove all other comments
|
// Issue 107: if there's any surrounding whitespace, it may be important, so
|
||||||
|
// replace the comment with a single space
|
||||||
|
return $hasSurroundingWs // remove all other comments
|
||||||
|
? ' '
|
||||||
|
: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -4,3 +4,6 @@
|
|||||||
/*! YUI Compressor style comments are preserved */
|
/*! YUI Compressor style comments are preserved */
|
||||||
|
|
||||||
/* but all other comments are removed */
|
/* but all other comments are removed */
|
||||||
|
|
||||||
|
/* comments that have any surrounding whitespace are replaced by a single space. */
|
||||||
|
body{ background:#fff/*eef*/ url(/path/to/image.gif) repeat-y; }
|
||||||
|
@@ -1,2 +1,3 @@
|
|||||||
|
|
||||||
/* YUI Compressor style comments are preserved */
|
/* YUI Compressor style comments are preserved */
|
||||||
|
body{background:#fff url(/path/to/image.gif) repeat-y}
|
@@ -2,3 +2,4 @@
|
|||||||
solid #0f7}div#content
|
solid #0f7}div#content
|
||||||
h1+p{padding-top:0;margin-top:0}@media all and (min-width: 640px){#media-queries-1{background-color:#0f0}}@media screen and (max-width: 2000px){#media-queries-2{background-color:#0f0}}
|
h1+p{padding-top:0;margin-top:0}@media all and (min-width: 640px){#media-queries-1{background-color:#0f0}}@media screen and (max-width: 2000px){#media-queries-2{background-color:#0f0}}
|
||||||
/* YUI Compressor style comments are preserved */
|
/* YUI Compressor style comments are preserved */
|
||||||
|
body{background:#fff url(/path/to/image.gif) repeat-y}
|
Reference in New Issue
Block a user