Provide more format options when exporting Icon for Android
lichin-lin opened this issue · comments
Issue
some of the icons got bypass since the converting from svg to xml format failed.
Reproduce Step
Run the command
figma-export icons -i figma-export.yaml
for this figma file & the yaml file:
---
figma:
lightFileId: XR1smKALBfAjLaz9v3OdQK
# [optional] Common export parameters
common:
icons:
# Name of the Figma's frame where icons components are located
figmaFrameName: Icons
images:
# Name of the Figma's frame where image components are located
figmaFrameName: Illustrations
# [optional] Android export parameters
android:
# Relative or absolute path to the `main/res` folder including it. The colors/icons/imags will be exported to this folder
mainRes: ./app/src/main/res
# Parameters for exporting icons
icons:
# Where to place icons relative to `mainRes`? FigmaExport clears this directory every time your execute `figma-export icons` command
output: "figma-export-icons"
images:
# Where to place images relative to `mainRes`? FigmaExport clears this directory every time your execute `figma-export images` command
output: "figma-export-images"
# Image file format: svg, png or webp
format: webp
# Format options for webp format only
webpOptions:
# Encoding type: lossy or lossless
encoding: lossy
# Encoding quality in percents. Only for lossy encoding.
quality: 85
the following error happened:
2020-10-08T15:03:36+0800 info: Using FigmaExport to export icons to Android Studio project.
2020-10-08T15:03:36+0800 info: Fetching icons info from Figma. Please wait...
2020-10-08T15:03:39+0800 info: Processing icons...
2020-10-08T15:03:39+0800 info: Downloading remote files...
2020-10-08T15:03:39+0800 info: Downloaded 1/79
2020-10-08T15:03:40+0800 info: Downloaded 2/79
...
2020-10-08T15:03:42+0800 info: Downloaded 78/79
2020-10-08T15:03:42+0800 info: Downloaded 79/79
2020-10-08T15:03:42+0800 info: Converting SVGs to XMLs...
-c parsed, so we will convert the SVG files
-in parsed /var/folders/ly/x5_phl3s2x150ff6d56b4hkc0000gn/T/6622183F-631A-433E-AFF2-275C2878A57C
error is In 24_icon_adder_anim.svg:
ERROR @ line 2: <mask> is not supported
error is In 24_icon_adder_bg.svg:
ERROR @ line 2: <mask> is not supported
...
error is In 24_icon_none.svg:
ERROR @ line 2: <mask> is not supported
error is In 24_icon_profile.svg:
ERROR @ line 2: <mask> is not supported
error is Error while parsing 24_icon_social_msg.svg:
Premature end of file.
error is In 24_icon_trophy.svg:
ERROR @ line 2: <mask> is not supported
ERROR @ line 6: <mask> is not supported
Convert 79 SVG files in total, errors found in 20 files
2020-10-08T15:03:43+0800 info: Writting files to Android Studio project...
2020-10-08T15:03:43+0800 info: Done!
Somehow the icons have <mask>
data in it, which AndroidStudio can not handle the converting. can we either provide svg format like:
...
android:
mainRes: ./app/src/main/res
icons:
output: "figma-export-icons"
format: svg
images:
...
or figure out a way that can make the converting (svg to xml) success, thank!
Version
0.16.1
Android Studio doesn't support SVG format. A designer must provide icons without masks.
Hi @subdan , so I installed Android Studio v4.0.2 and import the SVG icon, seems like the converting (to xml, it convert <mask>
into <clip-path>
tag) is working correctly:
I have check the vd-tool
that the repo is using, and it actually using v3.4.0
https://github.com/stasson/vd-tool#sources,
should the repo consider update the version for converting tool, so it can support more icon converting scenario.
Thanks. I will update vd-tool.
I've updated vd-tool from 3.4 to 4.1. Please check it again.
It works! thanks @subdan, all SVG icons that includes <mask>
tag can successfully convert into XML files :)
Cool!