Purpose: This demo aims to show how to fetch content from a Figma File.
-
requestFigmaFilethis will fetch all the Canvas objects from the file url & loop to get the IDs for each Canvas. -
requestFigmaImagethis function will fetch an image from a canvas ID. -
addToFigmaImageObject(WIP) this function will append the response from requestFigmaImage() and it will create a new Figma Image Layer. -
loadImageFromFigmaCDN(WIP) this function will create a new Figma Image Layer and it will preload the image into the session cache. -
setImageInFigmaImageLayer(WIP) this function include the image into the already created Figma Image Layer and it will push the Image Layer into the Page Component.
- Open the secret.coffee in /modules and add your own Figma Personal Token
exports.token = 'ai3-57wg5gbhe9-cspl-gclno-deheq-1qfrpxq6ax7x'
exports.fileurl = 'https://www.figma.com/file/FileKey/YourFile'- Create API Wrapper Module.
- Fetch GET single
filefrom URL. - Parse canvas from a given figma JSON file.
- Parse props from a
FRAMEnode type. - Parse props from a
VECTORnode. - Parse props from a
LINEvector. - Parse props from a
ELLIPSEvector. - Parse props from a
RECTANGLEvector. - Parse props from a
TEXTobject. - Parse props from a
TypeStylenode. - Fetch GET
imagesfrom node. - Fetch GET
projects. - Fetch GET
comments. - Fetch POST
comments.
- Scale: The
/v1/images/:keyENDPOINT provides a set of path parameters to have in mind. For instancescalewill need to be exposed to the current screen density on the prototype.
