douceur icon indicating copy to clipboard operation
douceur copied to clipboard

Problem with parsing prefixed keyframes

Open peterbe opened this issue 8 years ago • 4 comments

With this CSS

@-webkit-keyframes segment-spin {
  from {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg)
  }
  to {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg)
  }
}

I get:

Unexpected } character: CHAR (line: 11, column: 1): "}"

I think it's because it's not a recognized "AtRule". This works just fine to parse:

@keyframes segment-spin{
from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}
  to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}
}

Vendor prefixes makes me cry at night, but a possible solution would be to extend this line.

But pardon me, why maintain a list like that? What other strings that starts with a @ can't all be considered "at rules"? E.g this function could be something like:

func (rule *Rule) EmbedsRules() bool {
    return strings.HasPrefix(rule.Name, "@")
}

No?

peterbe avatar May 16 '16 20:05 peterbe

@aymerick Hi, How likely are you to have time to look into this issue? No pressure. Just curious if I have to fork the code for my own project (with attribution back to you of course).

peterbe avatar May 24 '16 16:05 peterbe

@peterbe you may want to check out https://github.com/chris-ramon/douceur

ernsheong avatar Oct 31 '16 14:10 ernsheong

@ernsheong You saved my day. Awesome. Thank you.

wooseopkim avatar Nov 11 '16 07:11 wooseopkim

@ernsheong You saved my day too.

czlhs avatar Mar 21 '19 09:03 czlhs