Skip to content

Build failing when using this template with SolidJS #343

Answered by Bravilogy
Bravilogy asked this question in Q&A
Discussion options

You must be logged in to vote

I think I actually found a solution, so I'll post it here just in case someone else stumbles upon the same thing. I replicated what this package does:
https://github.com/ryoid/solid-satori/tree/main/packages/solid-satori

for example:

export async function renderToSvg(
  component: () => JSX.Element,
  options: SatoriOptions
) {
  const result = await renderToStringAsync(component);
  const markup = htmlToReactNode(result);
  return satori(markup, options);
}

export async function generateOgImageForPost(post: CollectionEntry<"blog">) {
  const svg = await renderToSvg(() => postOgImage(post), options);
  return svgBufferToPngBuffer(svg);
}

And obviously updated style props in postOgImage and

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by satnaing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #295 on August 02, 2024 11:26.