@compai/jsx-to-html

Turn a JSX string with the sx prop into an HTML string.

Usage no npm install needed!

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

README

@compai/jsx-to-html

Turn a JSX string with the sx prop into an HTML string.

Installation

yarn add @compai/jsx-to-html

Usage

import fs from 'fs'
import { reactRender as render } from '@compai/jsx-to-html'

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.