shellscape / jsx-email

Build emails with a delightful DX
https://jsx.email
MIT License
902 stars 28 forks source link

Tailwind not working #67

Closed sysmat closed 8 months ago

sysmat commented 8 months ago

Expected Behavior

Actual Behavior

Additional Information

import { Button } from '@jsx-email/button';
import { Tailwind } from '@jsx-email/tailwind';

const Email = () => {
  return (
    <Tailwind
      config={{
        theme: {
          extend: {
            colors: {
              brand: '#007291'
            }
          }
        }
      }}
    >
      <Button
        href="https://example.com"
        className="bg-brand px-3 py-2 font-medium leading-4 text-white"
      >
        Click me
      </Button>
    </Tailwind>
  );
};
shellscape commented 8 months ago

Please add a reproduction. The issue template is very clear about that being required. Without one, we can't help fix your issue.

sysmat commented 8 months ago

jsx-email.zip

shellscape commented 8 months ago

Id really like to help you, but please read instructions. This is what our template says:

🚨 Issues WITHOUT a valid reproduction WILL BE CLOSED!

Please provide one by:

  1. Using the StackBlitz reproduction template at https://stackblitz.com/fork/jsx-email-repro
  2. Provide a minimal repository link (Read https://gist.github.com/Rich-Harris/88c5fc2ac6dc941b22e7996af05d70ff for instructions). Please use NPM for installing dependencies! These may take more time to triage than the other options.

    ⚠️ ZIP Files are unsafe and maintainers will NOT download them

.

sysmat commented 8 months ago

https://stackblitz.com/edit/jsx-email-repro-ipi7ah?file=package.json

shellscape commented 8 months ago

Thanks, looking into it. In the meantime, a workaround is to use the Html,Head, andBody` components like this:

<Html>
  <Head>
  <Body>
    <Tailwind>

example in doc is also wrong

It's not "wrong," because the example just shows assignment. It's an example, but it's not meant to be the exact code everyone should use in all places. Someone could use the code in the example docs directly with @jsx-email/render for instance.

shellscape commented 8 months ago

The twind project is an absolute mess, and there were some blind spots that I didn't see putting that together (even though it passed all of our tests). Please use v2.4.4 for now, or if you have basic tailwind needs you can use v3.0.0. A proper fix will take a while longer.

shellscape commented 8 months ago

I merged this fix and v3.0.1 will be published shortly. If you run into any more problems, downgrade to 2.4.4. It's slower, but will probably resolve any issues you run into.