-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
feat: Allow ampersand suffixes #923
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Huh; I thought this was a pretty straight-forward approach, but I'm getting test failures in rehydration: That shows the |
This reverts commit 5fa8f4c.
I reverted to a simpler approach, that doesn't use This passes the current test suite, b/c That said, the However the regexes currently assumes "the class name is at the beginning" (technically after the specificity prefix) and I'm not sure it's possible for the regex to handle "actually the class name may be at the beginning or end" / "before or after the pseudo selector", i.e.
This could probably work by adding a if (rehydrationIndex !== -1) {
const type = node.getAttribute('data-fela-type') || ''
const media = node.getAttribute('media') || ''
const support = node.getAttribute('data-fela-support') || ''
const css = node.textContent I.e. a This doesn't seem very hard, and is precedence for "rehydration hints" in the Dunno, personally I wouldn't need rehydration, so maybe getting "ampersand suffixes" supported in rehydration could be left as a todo? |
Description
Allows nested rules like:
Where the
&
comes at the end.Output:
This effectively fixes #702 , and mimics the Tailwinds capability of styling a child based on "some parent" being hovered.
I definitely understand the "nested selectors are terrible", and we have ~very few in our codebase 😅 (that currently uses Emotion), but this "change my style based on my parent", particularly with a CSS-driven
:hover
(instead of tracking parent hover state in JS), seems like a valid usage.Packages
Versioning
Minor
Checklist
Quality Assurance
pnpm run format
)pnpm run lint
)pnpm run test
)Changes
If one of the following checks doesn't make sense due to the type of PR, just check them.