Generate tailwind class names before deployment #1424
ben-sommer
started this conversation in
Ideas
Replies: 2 comments 7 replies
-
I am aware of this discussion but I am not seeing the same performance improvements. I am on the latest version of @react-email/tailwind (0.0.15). |
Beta Was this translation helpful? Give feedback.
2 replies
-
It's probably a better idea for us to somehow cache the class names to be re-used across renders. The issue mostly is that the user might apply or not a certain class name depending on the props, so we would need to know if they are doing this for a certain class name or not. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goals
style
object notationBackground
Building a very basic email template with just a handful of components takes 2-3 seconds on AWS Lambda with 512MB of allocated memory. Before I used AWS SES templates and they rendered and sent almost instantly, but they were a pain to update.
I manually converted all my tailwind classes to
style
attributes using this tool and my email now builds in 500ms. It doesn't make any sense to resolve all these tailwind classes EVERY time an email is rendered, when it could be done once when the templates are updated.Proposal
An optional build step should be added which copies all
.jsx
and.tsx
files to abuild
folder, but with allclassName
attributes processed. Tailwind classes would be removed, resolved and then added to thestyle
attribute, while non-tailwind classes would remain to allow custom css to function.I am happy to start work on this as I think many others would find it useful, especially those rendering emails in pay-per-second serverless environments.
Beta Was this translation helpful? Give feedback.
All reactions