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

feat(tailwind): extract pseudo classes to stylesheet #1864

Open
wants to merge 11 commits into
base: canary
Choose a base branch
from

Conversation

Sjoertjuh
Copy link

Solves the following discussion: #1338

This extracts pseudo classes like :hover to the stylesheet.

renovate bot and others added 3 commits December 10, 2024 10:27
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Copy link

changeset-bot bot commented Jan 13, 2025

🦋 Changeset detected

Latest commit: 1d9227a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@react-email/tailwind Minor
@react-email/components Patch
react-email-with-aws-ses Patch
react-email-with-mailersend Patch
react-email-with-nodemailer Patch
react-email-with-plunk Patch
react-email-with-postmark Patch
react-email-with-resend Patch
react-email-with-sendgrid Patch
react-email-with-next-scaleway Patch
react-email-with-node-scaleway Patch
react-email-starter Patch
create-email Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jan 13, 2025

@Sjoertjuh is attempting to deploy a commit to the resend Team on Vercel.

A member of the Team first needs to authorize it.

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: gabriel miranda <[email protected]>
@gabrielmfern gabrielmfern force-pushed the feature/extract-tailwind-pseudo-classes branch from 9a66e12 to fe2573d Compare January 14, 2025 11:47
Copy link
Collaborator

@gabrielmfern gabrielmfern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, really nice! We planned on having this at some point, so this is really helpful!

One thing that still needs an adjustment is when the user has a media query with pseudo selectors as well, I also added in a change in the tests that currently fails to ensure that this works.

https://github.com/Sjoertjuh/react-email/blob/a15b0b014e60d19b17e3f25f0cc6fd2e20578e77/packages/tailwind/src/tailwind.spec.tsx#L404-L409

Another thing I'd like improvement is the duplicated code between the sanitization of media queries and of the pseudo selectors, since they seem to be mostly the same.

@Sjoertjuh
Copy link
Author

I indeed forgot that you could mix media queries with pseudo classes, so I added that. Also the change in the test was not completely correct, so that is updated as well.
I don't have too much time at the moment, so I'll have a look later if some parts could be shared between the two (or maybe even put into a single function)

@gabrielmfern gabrielmfern force-pushed the canary branch 4 times, most recently from 9b6098c to ee6d8fb Compare January 22, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants