lupuswwww / cssmin

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

support keyframes for Opera and IE (Twitter Bootstrap is not minified correctly) #66

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What version of CssMin are you using (source and/or build)?
3.0.1

What was the input stylesheet and/or configuration options?
twitter bootstrap 2.2.2

What is the expected result?
@media query support - 1170px for .container on desktop (with resolution 
1366x768)

And what is the actual result and/or error message?
@media query does not works

Please provide any additional information below.

After small investigation I've noticed that -o-keyframes and -ms-keyframes are 
not supported and minify a code to:

@-o-keyframes "progress-bar-stripes"{from{background-position:0 
0;}to{background-position:40px 0;} // without last curly braket

Same with @-ms-keyframes

To fix it I've modified:
Line 3328:
$transformations = array("-moz-keyframes", "-webkit-keyframes", "-o-keyframes", 
"-ms-keyframes");

and added:
In line 4585:
        // Start of @keyframes at-rule block (@-o-keyframes)
        elseif ($char === "@" && $state === "T_DOCUMENT" && strtolower(substr($this->parser->getSource(), $index, 13)) === "@-o-keyframes")
            {
            $this->atRuleName = "-o-keyframes";
            $this->parser->pushState("T_AT_KEYFRAMES::NAME");
            $this->parser->clearBuffer();
            return $index + 13;
            }
        // Start of @keyframes at-rule block (@-ms-keyframes)
        elseif ($char === "@" && $state === "T_DOCUMENT" && strtolower(substr($this->parser->getSource(), $index, 14)) === "@-ms-keyframes")
            {
            $this->atRuleName = "-ms-keyframes";
            $this->parser->pushState("T_AT_KEYFRAMES::NAME");
            $this->parser->clearBuffer();
            return $index + 14;
            }

Sorry for not providing diff format - it's late and it's quicker for me to 
copy/paste

Hope it helps

Original issue reported on code.google.com by m...@wth.me on 11 Jan 2013 at 2:18

GoogleCodeExporter commented 8 years ago
Sorry - it's duplicate of Issue #50.
although it is missing below change:

Line 3328:
$transformations = array("-moz-keyframes", "-webkit-keyframes", "-o-keyframes", 
"-ms-keyframes");

Original comment by m...@wth.me on 11 Jan 2013 at 2:23

GoogleCodeExporter commented 8 years ago
To the original reporter of this issue, what does your addition to line 3328 
do?  I applied the patch from Issue #50 and it seems to work, so it doesn't 
seem your other line is needed.  But I wanted to check in with you because I 
don't want to miss anything... Thanks!

Original comment by auldrid...@gmail.com on 28 Feb 2013 at 3:18

GoogleCodeExporter commented 8 years ago
In my case when I was trying to minify twitter bootstrap it wasn't doing it 
properly because of -o-keyframes and -ms-keyframes.. I've added support for 
this in every place where -moz-keyframes existed. after my change I was able to 
minify it successfully.

Original comment by m...@wth.me on 1 Mar 2013 at 12:29

GoogleCodeExporter commented 8 years ago
Right, I was having the same issue with bootstrap which is how I found your 
defect report. I just wondered soecifically about your adjustment to line 3328 
as I have mine working with all edits except that line.

Thanks ,
Jim

Original comment by auldrid...@gmail.com on 1 Mar 2013 at 12:32