How to make this work?
ospfranco opened this issue · comments
Oscar Franco commented
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/",
},
})
// ...
Soheil Rashidi commented
You're right. That part needs a little more explanation.
But, you're doing it correctly. You only need to use the juiceResources method.
Oscar Franco commented
thanks that works!