FigmaToCode
FigmaToCode copied to clipboard
An easy way to support vectors
It seems that vectors are not supported now.
An easy way to support vectors is if the node's type === "VECTOR" and also has export settings, convert it to <img src="IMAGE_HOST/name.ext" />
For example (the following json is from https://api.figma.com/v1/files/ downloaded json file because I don't set up a Figma plugin dev environment)
{
"id": "6:3",
"name": "Camera",
"type": "BOOLEAN_OPERATION", // not sure if there is this type in plugin environment
"blendMode": "PASS_THROUGH",
// ...
"exportSettings": [
{
"suffix": "",
"format": "PNG",
"constraint": { "type": "SCALE", "value": 1.0 }
},
{
"suffix": "@2x",
"format": "PNG",
"constraint": { "type": "SCALE", "value": 2.0 }
},
{
"suffix": "@3x",
"format": "PNG",
"constraint": { "type": "SCALE", "value": 3.0 }
}
],
}
and covert it to <img src="IMAGE_HOST/Camera.png" />.
Then users can download exported images from Figma and place them into a folder, and then replace all IMAGE_HOST with the correct path.