Readme

Figma Frames Only

Function that accepts a Figma file JSON and returns only its' frames.

Only tested with a Figma file that has one (1) CANVAS only. A CANVAS is a Figma File Page.

See example here: @rodrigotello.OnlyFramesExample

1
2
3
4
5
6
7
8
9
10
11
export function FigmaFramesOnly(json: any): any {
const frames = [];
const canvases = json.document.children.filter((child) =>
child.type === "CANVAS"
);
for (const canvas of canvases) {
const children = canvas.children.filter((child) => child.type === "FRAME");
frames.push(...children);
}
return frames;
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023