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

Move common, trailing pseudo elements when generating selectors #281

Merged
merged 4 commits into from
Aug 17, 2022

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Aug 16, 2022

Fixes #280

There are some bugs in Tailwind's own selector rewriting for variants but also some bugs in the typography plugin selector rewriting. Use postcss-selector-parser to more properly handle selector rewriting of trailing pseudo elements.

This fixes the selector rewriting to check all simple selector sequences in each of the keys in theme.typography.*.css and extracts ::before, ::after, ::marker, and any other pseudo element only when they're the same across each of the selectors — including order. The reason for this is that it's possible in the future stacked pseudo elements could become a thing (there's a note in the CSS spec somewhere — but I forget where) meaning ::marker::before could mean something different from ::before::marker (even though both don't make sense or do anything right now).

@vercel
Copy link

vercel bot commented Aug 16, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
tailwindcss-typography ✅ Ready (Inspect) Visit Preview Aug 17, 2022 at 5:40PM (UTC)

@thecrypticace thecrypticace marked this pull request as ready for review August 17, 2022 17:41
@thecrypticace thecrypticace merged commit c1f01be into master Aug 17, 2022
@thecrypticace thecrypticace deleted the fix/common-trailing-pseudos branch August 17, 2022 17:41
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

Successfully merging this pull request may close these issues.

Erroneous ::before selector can be generated with darkMode: 'class'
1 participant