Closed xsyann closed 7 months ago
juice
is interesting, I'll take a look at that as an option. out of curiosity, what does build --check
return for your template? I'd like to know if it has warnings for those characters for gmail. We should probably also look at replacing css vars.
This is likely what we'll use https://github.com/tani/rehype-inline-css since juice
uses cheerio
and we've moved onto rehype/unified
. I'm thinking that we provide an option to inline the css, since it's a more expensive operation.
@xsyann I think that jsx-email@latest fixes both of the concerns here. production: true
compiles the multiple classes into one with compliant characters, and we're automatically replacing css variables now.
I'm using the new unified jsx-email
package, but still getting the same problem
@merunga could please you open a new issue with a reproduction for what you're seeing?
This one is about a slightly different topic
Going to close this one for now. If anyone finds new problems, please open a new issue with a reproduction and we'll take a look quickly.
Hi, thanks for your work on Tailwind, the performance has drastically improved (we went from 44s to 3-4s of rendering!)
However, if I understood correctly,
twind
generate the styles in a<style>
tag and keep the original tailwind classnames, unliketw-to-css
which converts the styles to inline styles. The issue with that is gmail seems very sensitive with the<style>
tag and removes it if it contains anything "fancy" (e.g. a selector containing !, a css variable like --tw-bg-opacity, etc).@jsx-email/tailwind
3.0.3
@jsxp-email/cli
Version?:3.0.1
18.16.0
Expected Behavior
Tailwind styles applied on gmail
Actual Behavior
All styles and tailwind classnames are dropped
Additional Information
Here is a simple template to reproduce the issue:
rendered to:
If I manually edit the css, it is correctly rendered:
Update:
Currently, I noticed that the two main issues are css variables (e.g.
var(--tw-text-opacity)
) and escaped chars in css classnames (e.g.!font-base
orw-[400px]
).The second one can be mitigated using
twind
hash feature (usingisProduction
on Tailwind component) but as a temporary quick workaround I chose to manually replace the variables in the generated html (usingreplaceAll
) and hashing classes prevent to able to do so.So my current setup is to manually replace tailwind variables in the generated html and use juice to inline the css: