Skip to content

Commit 2034aaa

Browse files
committed
Get CSS props from figma
1 parent 9650e2c commit 2034aaa

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

plugin/code.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const allPropertyNames = [
112112
"effects",
113113
"type",
114114
"layoutGrids",
115-
"absoluteRenderBounds"
115+
"absoluteRenderBounds",
116116
];
117117

118118
// The Figma nodes are hard to inspect at a glance because almost all properties are non enumerable
@@ -135,13 +135,6 @@ const cloneObject = (obj: any, valuesSet = new Set()) => {
135135
};
136136

137137
async function postSelection() {
138-
console.log(
139-
JSON.stringify(
140-
figma.currentPage.selection.map((obj) => cloneObject(obj)),
141-
null,
142-
2
143-
)
144-
);
145138
figma.ui.postMessage({
146139
type: "selectionChange",
147140
elements: fastClone(
@@ -271,10 +264,12 @@ async function serialize(
271264
},
272265
];
273266
}
267+
const cssProps = await element.getCSSAsync();
274268

275269
// TODO: better way to enumerate everything, including getters, that is not function
276270
return {
277271
...cloneObject(element),
272+
cssProps,
278273
fills,
279274
type: element.type === "VECTOR" ? "RECTANGLE" : element.type,
280275
data: JSON.parse(element.getSharedPluginData("builder", "data") || "{}"),

0 commit comments

Comments
 (0)