-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for VectorNodes exported as SVGs in HTML and Tailwind #145
Conversation
Added image of debug mode
* upstream: Enhance Tailwind Configuration and Color Handling (bernaferrari#143) Enhancements to Tailwind Class Generation and Figma Plugin Updates (bernaferrari#131) Delete tests (bernaferrari#141) Layer names (bernaferrari#142)
exportAsync is not very good. It tends to freeze the UI if something huge is inputted. It is fine, the only thing is that it is hard to detect the grouping. Nowadays things are a bit more standard than in the past, but you need to correctly identify that an icon is an icon and that is not trivial. |
@bernaferrari I'm really interested in understanding how it works and what the issues are. Do you have some figma files that you use for testing that have difficult to handle vectors? I think the UI should not freeze if we're using the async methods because they run in another process, probably wasm. If it is slow, i think it's understandable that a plugin not always work, especially if the input is super-complex. I tested with a big SVG and it took a while but did generate something: I tried using a stupidly big map SVG and it failed to export (but figma could also barely draw it) |
in theory yes, in practice that is not how Figma works, everything goes single-threaded 😛 ideally you export the italy map as a single svg. Like, with svg depending on the selection you get different things. So you can export italy as a single svg or multiple svgs, that's why grouping is important. It defines how many things are going into the svg. |
hmm. i wonder if we could walk thru the children and see if everything within is either a group or a vector, then could export it all at once. |
you can, but sometimes there might be rectangles, text, shapes, anything inside... it is impossible to do it perfectly. Even Figma now has a way to detect if something is an icon, but it works very poorly. Can use that if you want, but it is kind of bad. |
I see that there are a lot of issues with layout and groups. I'll need to look into this more. |
There are too many issues with this to make it a pull request right now. so i'm going to close it. but i'll link to this from one of the issues since there are interesting comments. |
If you can find a way that works well for you... |
I've added (started adding) support for exporting VectorNodes as SVG elements. I have only done some basic tests but so far it looks ok. I'd appreciate help with testing it further.
It seems this step has to take place before the nodes are converted to altNodes.
Known Issues:
exportAsync
and currently, there's no UI that informs the user that an asynchronous operation is happening. It'll probably be instantaneous in most cases, but there is the possibility that it takes a while and things get out of sync.vectorPaths
instead, but it seems like a pain in the ass to also convert the fills etc. into SVG when Figma is so kind to do this for us :D