RedMadRobot / figma-export

Command line utility to export colors, typography, icons and images from Figma to Xcode / Android Studio project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

All `/` in icon name replaced with `_` before regexps applied

osipxd opened this issue · comments

We have icon with name icons / 24 / arrow back and I want to save it as n2_icon_arrow_back_24.xml
I've configured validate and replace patterns:

nameValidateRegexp: '^icons / (\d\d) / ([A-Za-z0-9 /_-]+)$'
nameReplaceRegexp: 'n2_icon_$2_$1'
  1. Problem: Error: ❌ Bad asset name «icons _ 32 _ arrow back»
    Workaround: Replace / in validatingRegexp to _ (why / replaced with _?)
    nameValidateRegexp: '^icons _ (\d\d) _ ([A-Za-z0-9 /_-]+)$'
  2. Problem: Error: The file “n_2_icon_arrow_back_32.xml” doesn’t exist. (why n_2 but not n2?)
    Workaround: Haven't found. I've tried to remove n2 from nameReplaceRegexp, but the error is still here.
  1. FigmaExport automatically replaces symbol «/» with «_» before executing rexexps patterns because file name must not contains «/» symbol.
  2. This is a bug. I will fix it.
  1. FigmaExport automatically replaces symbol «/» with «_» before executing rexexps patterns because file name must not contains «/» symbol.

Maybe will be better to replace symbols after nameReplaceRegexp is applied? I think it will be more intuitive.

Maybe will be better to replace symbols after nameReplaceRegexp is applied? I think it will be more intuitive.

It will break backward compatibility. Every developer that use FigmaExport will need to update their regexps. This is not good.

I will fix 2-nd bug by the end of the week.
#145

I've fixed the second bug. Please update to the latest version (0.31.7) and check again.

I've fixed the second bug. Please update to the latest version (0.31.7) and check again.

Thanks, seems to be fixed.

Question about 1st problem. Is figma-export replaces only slashes / with underscores _?

Is figma-export replaces only slashes / with underscores _?

Yep

Yep

It would be great if this behavior will be documented

I’ll update documentation.

Added info about replacing "/" by "_" to CONFIG.md

Thanks! I close this issue.