Files
webstudio/packages/jsx-utils
Bogdan Chadkin 0c6a5ebbba refactor: migrate dashboard to postgrest (#3902)
Bumped type-fest everywhere to cast DashboardProject view
2024-08-09 17:47:49 +02:00
..
2023-10-06 09:07:59 +02:00
2023-10-01 12:17:43 +02:00
2023-10-01 12:17:43 +02:00
2023-10-01 12:17:43 +02:00
2023-10-01 12:17:43 +02:00

JSX Utils

Utilities to work with JSX, including converting it to Webstudio format.

Usage

Install the package

pnpm i @webstudio-is/jsx-utils

Transform a JSX string to Webstudio Embed Template:

import { jsxToWSEmbedTemplate } from "@webstudio-is/jsx-utils";

await jsxToWSEmbedTemplate("<Box>hello</Box>");

Other utils:

  • traverseTemplate and traverseTemplateAsync to traverse a WsEmbedTemplate and work with nodes
  • tailwindToWebstudio converts a template className prop to Webstudio local styles
  • heroiconsToSvgEmbed converts <HeroIcon name="iconName" type="solid"> to HtmlEmbed with inline SVG