ericmckean / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

CSS_Compressor leaves whitespace before negative CSS values #139

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Minify version: r352
PHP version: 5.2.0-8

Sample input:
span.flag.ac { background-position:  -32px      0 }

Expected output:
span.flag.ac{background-position:-32px 0}

Actual output:
span.flag.ac{background-position:  -32px      0}

The "remove ws between rules and colons" rule checks for /\b|[#'"]/; this
should instead be /\b|[#'"-]/ (include "-").

I would also suggest normalizing whitespace: s/\s{2,}/ /g. There may be
caveats with such a liberal replacement policy though.

This is a great project BTW. Thanks a million!

Original issue reported on code.google.com by jzs...@gmail.com on 25 Sep 2009 at 1:29

GoogleCodeExporter commented 9 years ago
First suggestion seems reasonable. I'll add a negative value to one of the test 
cases.

Normalizing indeed can break valid CSS (see URLs below) and who knows what 
crazy 
filter/vendor values are out there. I prefer feeling my way around pretty 
carefully 
in the regexes; peace-of-mind is worth missing a few spaces IMO.

http://code.google.com/p/minify/source/browse/trunk/min_unit_tests/_test_files/c
ss/
unusual_strings.css
http://code.google.com/p/minify/source/browse/trunk/min_unit_tests/_test_files/c
ss/
unusual_strings.min.css

Original comment by mrclay....@gmail.com on 26 Sep 2009 at 8:35

GoogleCodeExporter commented 9 years ago
Fixed in R411

Original comment by mrclay....@gmail.com on 9 May 2010 at 4:47