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

nameReplaceRegexp is not working

danielloureda opened this issue · comments

Hello!

I am trying to configure my own figma-export.yml but I am having issues with nameReplaceRegexp. I tried even with the examples you give in config.md but I cannot make it work... I may be doing something wrong or maybe I simply do not understand what is this param used for... but could you tell me if these params are ok? Basically, all I want is to append "ic_" to the beginning of the icon name.

icons:
output: "icons"
format: svg
nameValidateRegexp: '^[a-z A-Z0-9_]+$'
nameReplaceRegexp: 'ic_$1'

Thank you very much!

Hello.

$1 — means the first capture group but you don’t have a capture group in the nameValidateRegexp. Add round braces to nameValidateRegexp to add a capture group.

nameValidateRegexp: ^([a-z A-Z0-9_]+)$

Good morning,

I had tried that before writing the comment but it is still not working... I have these colors: content_bubbles, content_inverse_primary, content_negative, etc. With this yml it should get the whole name as first group and export color_content_bubbles, color_content_inverse_primary, color_content_negative and so on, right?

colors:
    # [optional] RegExp pattern for color name validation before exporting
    nameValidateRegexp: '^([a-z A-Z0-9_]+)$' # RegExp pattern for: background, background_primary, widget_primary_background
    # [optional] RegExp pattern for replacing. Supports only $n
    nameReplaceRegexp: 'color_$1'

Oh... forget it, I was setting these values in Android side, not in common...

Thank you very much anyway.