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

chore(tailwind): Small refactor for easier changes and ease of understanding #1351

Merged
merged 9 commits into from
Mar 12, 2024

Conversation

gabrielmfern
Copy link
Collaborator

@gabrielmfern gabrielmfern commented Mar 11, 2024

This was going to initially be address #1112, but I wasn't able to fix
it without first making improvements to the code's organization
because as it wasn't prioritized while we made the performance improvements
from before.

This does a few things to make the readability and organization a bit better:

  • Separate the code for inlining styles and for getting them all from the elements into two "hook"s
    • Not exactly a hook since re-renders don't happen, so it might seem a bit off with the name,
      but, by a hook, I mean mostly following the general ways of creating and using them
      that makes the code a bit more familiar and easier to understand
  • Don't replace the elements inside the array in place but rather, do a map over them
  • Process the Head as we're processing the elements
  • Separates the utils into different domains so that they're easier to find
  • Adds a few more comments to places that are not so intuitive

How can I test/review this?

Most of the work we've put into writing our unit tests to make sure basic things
are still working properly already assure things are fine, so the tests passing is already
a thing that we can rest assured on.

As for reviewing, you can just look for the changes I mentioned before to make sure
they seem fine here, I'll try adding a few comments per line so that's easier to
understand to what portions I'm referring to.

@gabrielmfern gabrielmfern self-assigned this Mar 11, 2024
Copy link

vercel bot commented Mar 11, 2024

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

Name Status Preview Comments Updated (UTC)
react-email ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 11, 2024 11:03am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
react-email-demo ⬜️ Ignored (Inspect) Visit Preview Mar 11, 2024 11:03am

@gabrielmfern gabrielmfern merged commit 9da83cb into canary Mar 12, 2024
9 checks passed
@gabrielmfern gabrielmfern deleted the fix/tailwind-head-minification-issue branch March 12, 2024 16:46
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.

None yet

2 participants