Skip to content

Commit 1156821

Browse files
committedJun 6, 2022
add docs
1 parent db81565 commit 1156821

File tree

6 files changed

+7752
-27
lines changed

6 files changed

+7752
-27
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
plugin/**/*.js
22
node_modules
33
dist
4+
5+
**/.DS_Store

‎.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16.14.0

‎README.md

+35
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const layers = htmlToFigma(document.body);
5656
```
5757

5858
## Auto-layout Vectors
59+
5960
When exporting Figma to Builder, the plugin requires all elements to be in auto-layout. However, it's not possible to auto-layout a vector. The alternative here is to use Figma's `rasterize selection` command on your vector. If the output of that is too low-resolution, then you can try this plugin: https://www.figma.com/community/plugin/837846252158418235/Flatten-Selection-to-Bitmap.
6061

6162
If you want the Builder end-result to have a vector, then consider this rasterized selection as a placeholder, and swap it back with an SVG in the Builder editor.
@@ -65,6 +66,7 @@ If you want the Builder end-result to have a vector, then consider this rasteriz
6566
Importing HTML layers to Figma is a best-effort process. Even getting 90% there can save you a ton of time, only having to clean up a few things.
6667

6768
A few known limitations:
69+
6870
- not all element types are supported (e.g. iframe, pseudoelements)
6971
- not all CSS properties are supported or fully supported
7072
- not all types of media are supported (video, animated gifs, etc)
@@ -81,3 +83,36 @@ If you find any issues or have feedback at all please [make an issue](https://gi
8183
<p align="center">
8284
Made with ❤️ by <a target="_blank" href="https://builder.io/">Builder.io</a>
8385
</p>
86+
87+
## Architecture
88+
89+
- `builder.io/api/v1/html-to-figma`: API endpoint that converts a URL's layout to a Figma design. The logic of that endpoint lives in this repo, under [./lib/html-to-figma](./lib/html-to-figma).
90+
- `builder.io/api/v1/figma-to-builder`: API endpoint that converts a Figma design to a Builder content JSON. The logic of that endpoint lives in Builder's API.
91+
92+
## DEVELOP - Figma plugin
93+
94+
### Setup local development plugin
95+
96+
- install the Figma desktop app through https://www.figma.com/
97+
98+
- Right click Plugins -> Development -> Import plugin from manifest
99+
<img src="./assets/dev-import.png" />
100+
101+
- Choose `manifest.json` in this repo
102+
103+
- Now you can access/test the local plugin code in this repo by navigating to: Right click Plugins -> Development -> HTML <> Figma
104+
<img src="./assets/dev-use.png" />
105+
106+
### Develop
107+
108+
```bash
109+
# install
110+
npm install
111+
112+
# run tsc server
113+
npm run dev
114+
```
115+
116+
NOTE: make sure to enable this boolean:
117+
118+
https://github.com/BuilderIO/figma-html/blob/db81565798c2989f701ae2b6b0aeaff175b9108b/plugin/ui.tsx#L45

‎assets/dev-import.png

430 KB
Loading

‎assets/dev-use.png

722 KB
Loading

‎package-lock.json

+7,714-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.