Created
October 17, 2019 18:53
-
-
Save thomas-lowry/27ab66d51c7fe705bf8c678a69178ef0 to your computer and use it in GitHub Desktop.
Ungroup groups with one child in Figma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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