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

Pseudoselectors without & prefix emit malformed CSS #323

Closed
quantizor opened this issue Dec 27, 2023 · 2 comments
Closed

Pseudoselectors without & prefix emit malformed CSS #323

quantizor opened this issue Dec 27, 2023 · 2 comments

Comments

@quantizor
Copy link
Contributor

div {
  :hover {
    color: red;
  }
}

The above code used to work in stylis v3, but it seems since stylis v4 an ampersand is explicitly required, e.g.

div {
  &:hover {
    color: red;
  }
}

Can the prior functionality to pretend an & is there for a leading : be restored?

@Andarist
Copy link
Collaborator

Andarist commented Dec 27, 2023

Can the prior functionality to pretend an & is there for a leading : be restored?

No. This was an explicit breaking change - one that fixed some old issues here. This matches the SASS/Less/etc behavior.

In Emotion, I had to figure out how to restore the old functionality on our side and we always include a custom "compat" plugin. If you'd be interested in reusing this, I could move this to a separate package or something.

I think I'd like to start deprecating this old behavior in Emotion soon-ish so we could ship the next major version without this plugin.

@quantizor
Copy link
Contributor Author

Got it, thanks!

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