-
-
Save hiloki/a74939f2f29de69c24fd1e795c5edcfe to your computer and use it in GitHub Desktop.
Figma Plugin scripts: Rename by convention
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
const selection = figma.currentPage.selection; | |
selection.forEach(node => { | |
// Get current name | |
const srcName = node.name; | |
// Split by slash e.g. Questionnaire, Age | |
const splitName = srcName.split('/'); | |
const newName = splitName.map(name => { | |
// Remove start/end space, and to lowercase | |
return name.trim().toLowerCase(); | |
}) | |
// Assign new name | |
node.name = newName.join('/') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment