-
Notifications
You must be signed in to change notification settings - Fork 54
Conversation
|
'name': 'meta.at-rule.keyframes.scss' | ||
'patterns': [ | ||
{ | ||
'match': '(?<=keyframes[ \\t])(?:[_A-Za-z][-\\w]|-[_A-Za-z])[-\\w]*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not liking this lookbehind because it doesn't take into account multiple spaces.
Also I think the other half can be rewritten as (?:-?[_A-Za-z])[-\\w]*
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it can be, if you don't want to impose the "must contain at least 2 characters" restriction, coz it also matches something like _
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(?:-?[_A-Za-z])[-\\w]+
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆 That imposes a new restriction that if the identifier starts with -
, it must contain at least 3 characters.
My biggest issue with this is the use of lookbehinds. |
Better? |
The animation-name can be specified as an identifier or string. * A valid CSS identifier * begins with [-_A-Za-z], followed by any number of [-_A-Za-z0-9] * must contain at least 2 characters * if begins with -, the next character must be [_A-Za-z] In fact, other characters are also allowed as long as they are escaped, but escape sequences are rarely used in identifiers, and the inclusion of which will result in a very complicated pattern. * For keyframe selectors, values less than 0% or greater than 100% are invalid.
.scss can be kept for now. |
Anything else? |
Why is |
TL;DR. Performance. But I just did a benchmark, turns out My thoughts:
So in most cases, |
Last thing: Replacing the space with |
Still think |
fixes #157