Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse CSS modules syntax for @keyframes :local(ident) #393

Open
jsnajdr opened this issue May 27, 2024 · 2 comments
Open

Parse CSS modules syntax for @keyframes :local(ident) #393

jsnajdr opened this issue May 27, 2024 · 2 comments

Comments

@jsnajdr
Copy link

jsnajdr commented May 27, 2024

The VSCode CSS parser fails to parse the CSS modules syntax for scoping keyframes identifiers:

Screenshot 2024-05-24 at 13 22 36

The SASS tool (both the Dart and C++) implementations parse the @keyframes identifier either as a selector, or just as a generic raw params string (anything between atrule and start of the block), I'm not sure. But they are able to pass the :local(ident) string to a tool like postcss-modules which transforms it into a valid, locally scoped identifier.

@mirka
Copy link

mirka commented May 27, 2024

Might be obvious given the error ("identifier expected" rather than "unknown pseudo class" or something), but I'll add that this also isn't resolved by adding the pseudos to css.customData, e.g.:

{
	"version": 1.1,
	"pseudoClasses": [
		{
			"name": ":local",
			"description": "css modules local"
		}
	]
}

@jsnajdr
Copy link
Author

jsnajdr commented May 27, 2024

Pseudoclasses are used only when scoping selectors. This is CSS modules syntax that is already syntactically valid:

:local {
  .foo {
    color: blue;
  }
}

But @keyframes :local(foo) is a special incompatible extension. According to the standard, it should be only a simple string identifier. And the VSCode CSS parser really insists that it's an identifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants