Skip to content

Commit 9b9f895

Browse files
committed
Additional discussion of to_html
1 parent b1014ea commit 9b9f895

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed
149 KB
Loading
File renamed without changes.

src/to_html/README.md

+36-10
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,39 @@ Generate HTML files from files fetched through the
77

88
[example](../../example-figma-files/gov-uk-design-system-components/button.html)
99

10+
![Screenshot of button.html as rendered by Firefox](../../README-images/buttons-html-rendered.png)
11+
1012
```html
1113
<div
1214
style="
13-
color: #fff;
14-
font-family: GDS Transport Website;
15-
font-size: 19px;
16-
font-weight: 300;
17-
line-height: 25px;
15+
background: #00703c;
16+
flex-direction: column;
17+
justify-content: center;
18+
align-items: center;
19+
padding: 8px 12px 7px;
20+
line-height: 0;
21+
display: flex;
22+
position: absolute;
23+
top: 23px;
24+
left: 17px;
25+
box-shadow: inset 0 -2px #002d18;
1826
"
19-
data-figma-name="Content: Text"
20-
data-figma-id="1:9"
27+
data-figma-name="Viewport=Desktop, Type=Primary, Hover=False, Focus=False, Disabled=False"
28+
data-figma-id="1:19"
2129
>
22-
Button
30+
<div
31+
style="
32+
color: #fff;
33+
font-family: GDS Transport Website, arial, sans-serif;
34+
font-size: 19px;
35+
font-weight: 300;
36+
line-height: 25px;
37+
"
38+
data-figma-name="Content: Text"
39+
data-figma-id="1:9"
40+
>
41+
Button
42+
</div>
2343
</div>
2444
```
2545

@@ -29,7 +49,9 @@ made to use CSS stylesheets or assign helpers like CSS classes.
2949
Some absolute positioning and absolute sizing is used where it can't be avoided.
3050
Using
3151
[auto-layout](https://help.figma.com/hc/en-us/articles/5731482952599-Using-auto-layout)
32-
mostly prevents that as it gets converted to flex-box.
52+
mostly prevents that as it gets converted to flex-box. In the example above
53+
absolute positioning is used to position the outer `<div>` as the component-set
54+
itself doesn't use auto-layout.
3355

3456
The HTML maps directly to nodes within Figma. A deeply nested Figma design will
3557
generate deeploy nested html.
@@ -38,6 +60,10 @@ No fallback fonts are specified.
3860

3961
Vectors are replaced by an SVG placeholder.
4062

63+
Semantic HTML elements aren't used. Everything is a `<div>` or `<svg>` (for
64+
vectors). Component appropriate elements like `<button>` or `<input>` are not
65+
used.
66+
4167
## Direction
4268

4369
I'm undecided to if this is going to be:
@@ -57,7 +83,7 @@ cargo run --release -- to-html 213:6 < example-figma-files/gov-uk-design-system.
5783

5884
You can get the node id from the URL when using the web-ui.
5985

60-
![Screenshot of Gov UK design system in Figma web view with Button component selected and node-id=213-6 highlighted in the address bar](../../selecting-node-id.png)
86+
![Screenshot of Gov UK design system in Figma web view with Button component selected and node-id=213-6 highlighted in the address bar](../../README-images/selecting-node-id.png)
6187

6288
The HTML can be piped through additional commands to add fallback fonts and to
6389
format the HTML.

0 commit comments

Comments
 (0)