Running plugin API code in the JavaScript console is the best Figma feature you've never used. Here's the code:
const [collection] = await figma.variables.getLocalVariableCollectionsAsync();
collection.variableIds.forEach(async function arrow(id) {
const variable = await figma.variables.getVariableByIdAsync(id);
variable.setVariableCodeSyntax(
"WEB",
`var(--color-${variable.name.replace(/\//g, "-").toLowerCase()})`
)
})
____________________________________________________
Find us on ⬇️
X (formerly Twitter): https://x.com/figma
Instagram: / figma
LinkedIn: / figma
TikTok: / figma
Figma forum: https://forum.figma.com/
On this page of the site you can watch the video online Solving Problems with JavaScript: Variable Code Syntax | Figma with a duration of hours minute second in good quality, which was uploaded by the user Figma 06 February 2025, share the link with friends and acquaintances, this video has already been watched 14,229 times on youtube and it was liked by 563 viewers. Enjoy your viewing!