Files
webstudio/packages/jsx-utils
Bogdan Chadkin e09f8a184e build: switch to pnpm linker (#3168)
With new remix setup we may finally not need hoisted linker which makes
pnpm very buggy.

Here added all missing dependencies to package.json and removed node
linker from .npmrc.
2024-04-14 23:07:53 +07:00
..
2023-10-06 09:07:59 +02:00
2023-10-15 21:39:57 +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