plugins/figma-to-wordpress-studio moves a Figma file into WordPress by posting a Figma source payload to the local WordPress Studio app. Studio creates the site and imports the result with Static Site Importer and Blocks Engine.
Figma plugin UI
-> current-page scenegraph + selected-node intent
-> Studio Figma source payload
-> local WordPress Studio handoff endpoint
-> WordPress Studio site
-> Static Site Importer / Blocks Engine inside WordPress
The TypeScript boundary stops at source capture and a local handoff request. WordPress, PHP, Static Site Importer, Blocks Engine, and Studio site orchestration remain Studio runtime concerns.
Figma plugin UIs run in a constrained browser context. That context is friendly to HTML, CSS, and client-side JavaScript, but it is not a normal browser tab.
Practical constraints for this browser-based flow:
- Cross-origin iframes can be blocked or limited.
- Popup and new-tab behavior can be host-dependent.
- Large WASM boot flows may not behave reliably inside the plugin UI.
- Clipboard access can require user activation.
- Local file URLs can behave differently between desktop Figma, browser Figma, and development builds.
Because of those constraints, the integration shape is a local Studio handoff: the plugin posts Figma source data to Studio's loopback endpoint. If Studio is not running, the plugin surfaces the connection error.
WordPress Studio is the correct place to run WordPress and PHP plugin logic. It provides the WordPress runtime and accepts flexible studio create --from <source> inputs, including Figma source, artifact JSON, .fig, file, directory, zip, and URL shapes.
Static Site Importer and Blocks Engine should run in that WordPress runtime because they are WordPress/PHP import systems. The Figma plugin should not reimplement them in TypeScript. The plugin's job is to hand off design data with enough metadata for Studio to route through Static Site Importer and clean up importer dependencies after a successful import.
Implemented now:
GeneratedWebsiteArtifactfor static generated files from Figma.wordpress-studio/figma-source/v1for the primary Studio Figma handoff.blocks-engine/php-transformer/site-artifact/v1retained as debug/diagnostic context.- A Figma UI client that posts the source payload to local Studio.
toFigmaSourcePayload() produces wordpress-studio/figma-source/v1. Studio receives it as the source property of a JSON request, alongside the Figma document name as siteName.
The payload preserves the source needed for a Studio-side transform:
sourceidentifies Figma, includes file and page metadata, and records the export timestamp.intentrecords whether the user selected nodes or the current page, including the page and selected root node IDs.scenegraphincludes the normalized current page and selected nodes rather than only generated HTML.assetscarries the normalized exported assets.transformrequests thestatic-site-importer/figmaroute with a WordPress target, preserved source scenegraph, asset import, selection scope, page ID, and selected node IDs.debugcarries a per-request handoff ID, a bounded summary, diagnostics, and metadata. The generated website artifact remains local to avoid duplicating binary assets in the handoff request.
The debug summary is deterministic from the selected source and generated artifact. It reports the selection scope and page, selected-node count, recursive node count, asset count, and diagnostic, warning, and error counts. When no nodes are selected, node counting falls back to the current page. generate-artifact.test.mjs fixes this shape with a selected-node fixture and verifies the route, preservation options, handoff ID, bounded debug payload, and summary counts.
The UI posts to http://127.0.0.1:48732/figma-to-wordpress/import with Content-Type: application/json. The Studio button remains disabled until normalized selection data is available and while a request is active.
Each request receives a figma-... handoff ID. On success, Studio may return requestId, siteName, siteUrl, and importSummary; the UI displays the accepted site and logs those values with the handoff ID, payload schema, selection identity, source summary, and generated artifact file/entrypoint summary.
A non-2xx response or a response without success: true is a failed handoff. The visible error uses Studio's response message when available, appends its request ID for correlation, and otherwise includes the HTTP status. Network and response failures are logged with the same handoff ID and source summary, while the generated artifact remains available in local plugin diagnostics.
Not implemented yet:
- Post-import block validation and visual parity checks.
From the repository root, run the plugin checks:
npm run check --prefix plugins/figma-to-wordpress-studio
npm run build --prefix plugins/figma-to-wordpress-studio
npm test --prefix plugins/figma-to-wordpress-studioFigma development test:
- Run
npm run build --prefix plugins/figma-to-wordpress-studio. - Load
plugins/figma-to-wordpress-studio/manifest.jsonas a Figma development plugin. - Run the plugin.
- Start a compatible WordPress Studio build.
- Use
Open in WordPress Studio. - Studio creates the site and opens the local site URL in your browser. If Studio is not reachable, the plugin reports the connection error.
The next meaningful step is Studio-side routing for wordpress-studio/figma-source/v1, plus richer progress/error reporting around imports and post-import block/visual validation. That should remain in the Studio layer, not by porting PHP importer behavior into the Figma plugin.