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

How to make this work? #3

Closed
ospfranco opened this issue Jan 7, 2022 · 2 comments
Closed

How to make this work? #3

ospfranco opened this issue Jan 7, 2022 · 2 comments

Comments

@ospfranco
Copy link

Thanks a lot for the package but the usage instructions are not clear at all. I have Juice installed, but then how do I pass the css file into it to render the email?

const TestMail = () => {
  return (
    <div>
      <head>
        <link rel="stylesheet" href="index.css" />
      </head>
      <h1 className="text-xl font-bold border-b">You have a new Test Email on Productlane</h1>
      <p className="border-b">Something something</p>
      <a href="https://productlane.io/feedback" className="bg-purple-600">
        Open
      </a>
    </div>
  )
}

export function testMailer({ to }: IParams) {
  const emailHtml = ReactDOMServer.renderToStaticMarkup(<TestMail />)
  const processedHtml = juice(emailHtml, {
    webResources: {
      relativeTo: "../app/core/styles/",
    },
  })

// ...
@soheilpro
Copy link
Owner

You're right. That part needs a little more explanation.

But, you're doing it correctly. You only need to use the juiceResources method.

@ospfranco
Copy link
Author

thanks that works!

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

No branches or pull requests

2 participants