arbk / cssmin

CssMin - A (simple) css minifier with benefits. (exported from Google Code)
http://code.google.com/p/cssmin/
1 stars 1 forks source link

Support @-ms-keyframes and @-o-keyframes #50

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?
Rules like:
@-ms-keyframes 'message-show-hide' {
  25% {
    -ms-transform:translate(0, 48px);
  }
  60% {
    -ms-transform:translate(0, 48px);
  }
  70% {
    -ms-transform:translate(0, 48px);
  }
  80% {
    -ms-transform:translate(0, 48px);
  }
  90% {
    -ms-transform:translate(0, -36px);
  }
  100% {
    -ms-transform:translate(0, -48px);
  }
}

@-o-keyframes 'message-show-hide' {
  25% {
    -o-transform:translate(0, 48px);
  }
  60% {
    -o-transform:translate(0, 48px);
  }
  70% {
    -o-transform:translate(0, 48px);
  }
  80% {
    -o-transform:translate(0, 48px);
  }
  90% {
    -o-transform:translate(0, -36px);
  }
  100% {
    -o-transform:translate(0, -48px);
  }
}

What is the expected result?
@-ms-keyframes "message-show-hide"{25%{-ms-transform:translate(0, 
48px);}60%{-ms-transform:translate(0, 48px);}70%{-ms-transform:translate(0, 
48px);}80%{-ms-transform:translate(0, 48px);}90%{-ms-transform:translate(0, 
-36px);}100%{-ms-transform:translate(0, -48px);}}

And what is the actual result and/or error message?
@-ms-keyframes "message-show-hide"{25%{-ms-transform:translate(0, 
48px);}60%{-ms-transform:translate(0, 48px);}70%{-ms-transform:translate(0, 
48px);}80%{-ms-transform:translate(0, 48px);}90%{-ms-transform:translate(0, 
-36px);}100%{-ms-transform:translate(0, -48px);}

Please provide any additional information below.
Missing last bracket. Results in parsing error in Chrome.

Original issue reported on code.google.com by audvare on 19 Jan 2012 at 3:01

GoogleCodeExporter commented 8 years ago
Fixed patch for @-o-keyframes.

Original comment by audvare on 19 Jan 2012 at 3:19

Attachments:

GoogleCodeExporter commented 8 years ago
Please apply this patch. Without it, we are unable to minify the Bootstrap 
framework.

Original comment by ian...@gmail.com on 28 May 2012 at 11:45

GoogleCodeExporter commented 8 years ago
This also breaks firefox css parser. The patch works like a charm.

Original comment by colinda...@gmail.com on 13 Jun 2012 at 1:36

GoogleCodeExporter commented 8 years ago
Found this via Issue #66 - thanks to both for reporting and providing fixes. I 
too am having trouble using CSS Min w/ Twitter's Bootstrap

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

GoogleCodeExporter commented 8 years ago
@-ms-keyframes and @-o-keyframes are not considered valid at-rules.
Add this code in class CssAtKeyframesParserPlugin, function parse, near line 
4560:

// 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;
        }
        // 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;
        }

Original comment by oderfla...@gmail.com on 11 Feb 2015 at 4:06