Skip to content

Instantly share code, notes, and snippets.

@AfzalivE
Last active February 6, 2023 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AfzalivE/1dd39c0c7807bd4300d2327a6cc677f1 to your computer and use it in GitHub Desktop.
Save AfzalivE/1dd39c0c7807bd4300d2327a6cc677f1 to your computer and use it in GitHub Desktop.
Figma to Drawable folder Transnomino recipe

This is a recipe for Transnomino app on Mac to rename and move files exported from Figma to an Android app's drawable folders.

There's one assumption here that layer names in figma are something like Light/Layer Name and Dark/Layer Name. Although, I imagine it'd be trivial to change it to something that's separated by a character other than /.

In Figma, the layer suffixes needs to be either

  1. HDPI, MDPI, XHDPI, XXHDPI, XXXHDPI
  2. -hdpi, -mdpi, -xhdpi, -xxhdpi, -xxxhdpi

If using #2, disable the 3rd step (Hyphenate suffix).

{"recipe_format_version":"7.0","sortOrder":"default","transformers":[{"id":"transformer_18619AB2723","properties":{"simpleWildcards":true,"simpleReplaceText":{"properties":[{"value":"drawable-night","prefix":"","type":"string","suffix":""}]},"simpleFindText":"Dark","simpleCaseInsensitive":true},"transformScope":"path","type":"simple","disabled":false},{"id":"transformer_18619AC29D8","properties":{"simpleWildcards":true,"simpleReplaceText":{"properties":[{"value":"drawable","prefix":"","type":"string","suffix":""}]},"simpleFindText":"Light","simpleCaseInsensitive":true},"transformScope":"path","type":"simple","disabled":false},{"id":"transformer_18619B5C501","properties":{"regexReplaceText":{"properties":[{"value":"-$1","prefix":"","type":"string","suffix":""}]},"regexCaseInsensitive":true,"regexFindText":{"properties":[{"value":"([XMH]+DPI)","prefix":"","type":"string","suffix":""}]}},"transformScope":"filename","type":"regularexpression","description":"Hyphenate suffix","disabled":false},{"id":"transformer_18619B86CCC","properties":{"conversionType":"lowercase","conversionMatch":"","conversionScope":"allscope"},"transformScope":"filename","type":"conversion","disabled":false},{"id":"transformer_18619BC9176","properties":{"simpleWildcards":true,"simpleReplaceText":{"properties":[{"value":"_","prefix":"","type":"string","suffix":""}]},"simpleFindText":" ","simpleCaseInsensitive":true},"transformScope":"filename","type":"simple","description":"Convert spaces to _","disabled":false},{"id":"transformer_18619AC9D4D","properties":{"regexReplaceText":{"properties":[{"value":"drawable$1-$3\/$2","prefix":"","type":"string","suffix":""}]},"regexCaseInsensitive":false,"regexFindText":{"properties":[{"value":"drawable(-night)?\/","prefix":"","type":"string","suffix":""},{"value":"regex","regexp":{"custom":"_","anchor":"none","alphabetic":true,"containing":true,"count":0,"whitespace":true,"numeric":false,"punctuation":false},"prefix":"","type":"regex","suffix":""},{"value":"-([xmh]+dpi)","prefix":"","type":"string","suffix":""}]}},"transformScope":"fullpath","type":"regularexpression","description":"Move the resolution suffix to folder name","disabled":false}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment