@compai/jsx-to-png

Turn a JSX string with the sx prop into a png image.

Usage no npm install needed!

<script type="module">
  import compaiJsxToPng from 'https://cdn.skypack.dev/@compai/jsx-to-png';
</script>

README

@compai/jsx-to-png

Turn a JSX string with the sx prop into a png image.

Installation

yarn add @compai/jsx-to-png

Usage

import fs from 'fs'
import { render } from '@compai/jsx-to-png'

const JSX = `
<h1
  sx={{
    backgroundColor: 'tomato'
  }}
>
  Hello, world!
</h1>
`

(async () => {
  const png = await render(JSX)
  fs.writeFileSync('test.png', png)
})()

Related


OSS by Components AI.