fresh92 / cssmin

Automatically exported from code.google.com/p/cssmin
0 stars 0 forks source link

CssMin incorrectly inserting semicolon after line break in "src" of @font-face #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What version of CssMin are you using (source and/or build)?
2.0.2.2 (occurred in earlier versions as well)

What was the input stylesheet and/or configuration options?

The CSS in question looks like this:
@font-face 
{
    font-family: 'MyFont';
    src: url('webfont.eot');
    src: url('webfont.eot?#iefix') format('embedded-opentype'),
         url('webfont.woff') format('woff'),
         url('webfont.ttf') format('truetype'),
         url('webfont.svg#MyFont') format('svg');
    font-weight: normal;
    font-style: normal;
}

The CssMin options used were:
array("convert-color-values"=>true,
      "compress-color-values"=>true,
      "compress-unit-values"=>true)

What is the expected result?
CSS that is valid and results in fonts displaying.

And what is the actual result and/or error message?
IE 9 worked as expected.  FireFox 5 failed to render the font.  Opera 11.11 
fails to render and gives the error "Declaration syntax error".  Reviewing the 
generated CSS file, I see the above cited CSS was transformed into the 
following:

@font-face{font-family:'MyFont';src:url('webfont.eot');src:url('webfont.eot?#ief
ix') format('embedded-opentype'),;url('webfont.woff') format('woff'),
 url('webfont.ttf') format('truetype'),
 url('webfont.svg#MyFont') format('svg');
 font-weight:normal;font-style:normal}

Note the inappropriate semicolon after "('embedded-opentype')".

Please provide any additional information below.

I was able to avoid the problem if I put all of the urls on the same line 
instead of line breaking after each comma.  This makes the original CSS 
difficult to read, however.  

The original CSS cited above works as expected in all browsers when not 
minified.

I did not note the same problem if I broke up other declarations across lines.  
Admittedly, the other things I tried did not include commas.  E.g.:

border: 5px
        solid
        red;

Original issue reported on code.google.com by timothy....@gmail.com on 25 Jun 2011 at 5:57

GoogleCodeExporter commented 8 years ago
Thanks for reporting this bug. This problem is fixed in version 3.x.

But the minifification is still incorrect because the linefeed in the 
declaration value are still there. While the minification is not optimal the 
output is valid css and should work in every browser.

So i will close this issue as fixed and create a new issue for the incorrect 
minification.

Original comment by joe.scylla on 13 Jul 2011 at 8:46