Files
webstudio/packages/jsx-utils
Bogdan Chadkin a65ab3379f build: forbid unused parameters (#3732)
Enabled flag in tsconfig to forbid unused parameters.
2024-07-15 21:17:13 +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