Skip to content

Instantly share code, notes, and snippets.

@thomas-lowry
Created October 17, 2019 18:53
Show Gist options
  • Save thomas-lowry/27ab66d51c7fe705bf8c678a69178ef0 to your computer and use it in GitHub Desktop.
Save thomas-lowry/27ab66d51c7fe705bf8c678a69178ef0 to your computer and use it in GitHub Desktop.
Ungroup groups with one child in Figma
var groupsWithOneChild = Array.from(figma.root.findAll(x => x.type === 'GROUP' && x.children.length === 1));
if (groupsWithOneChild) {
groupsWithOneChild.forEach(group => {
let parent = group.parent;
let index = parent.children.indexOf(group);
let child = group.children[0];
parent.insertChild(index, child);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment