Skip to content

scuffed @custom-variant behavior #1211

Closed
@tizu69

Description

@tizu69

Registering a v4 custom-variant with a nested (pseudo-)selector causes "at-rule or selector expected". It compiles just fine.

@custom-variant poi {
	&:hover,
	&:focus-visible {
		@slot;
	}
}

Image

The last 2 errors go away on removing the @slots ;. However, this is not a viable option, as Prettier adds it back.


Oddly enough, it seems to replace this with... whatever this mess is.

Image


Image

This happens because the Regex matches up to a ;: (\s+[^;]+). I'm not sure what the point of this is.
There is another matcher that uses { right below, but it never gets called, as the matcher with the ; already
replaces everything up to the slot semicolon.

Removing it seems to have done the trick. All tests pass with this change.


Image

... now this throws. Even if I restore the original extension. lovely.

The space was added by Prettier, but this also happens without it. Adding other spaces restores it to [ *], so my PR allows a space before *.

It seems like it doesn't like *. Replacing it with _ in the virtual document works fine. All tests pass with this change.


I'd like to work on this. I'll follow up with a PR in a bit.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions