-
Notifications
You must be signed in to change notification settings - Fork 334
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
[Proposal] AST approach for HTML, Tailwind, BEM, etc #120
Comments
I like it! |
I like it too! |
@bernaferrari you mentioned AST refactoring in another issue... |
Hey @bernaferrari,
Whilst working on the Tailwind renderer and the variables stuff, I noticed quite a lot of duplication, and some situations where it would be difficult or cumbersome to re-process elements once rendered as strings.
For example:
getLocalVariables()
is deprecated in favour ofgetLocalVariablesAsync()
meaning Tailwind functions may need to beasync
at some pointI know you have an interm "alt-node" format, but I figured an additional interim AST format would work at least in the HTML domain, so the Figma element would be parsed to this standard format, then that format could be more-easily processed then manipulated, for example:
A single renderer which walks the tree is also simpler than having each node render its HTML.
Potentially could even simplify platform implementation by:
classes
tostyles
(using the build-time generated classes)I had a bit of bash this morning and got an initial renderer up and running (have yet to integrate with existing platform code):
Here's the AST:
And the HTML:
Anyway.
Another one for ideas to improve.
I think I can probably finish the variables stuff for now, but this would certainly be a more robust solution in the long term.
Will commit the code at some point and PR.
The text was updated successfully, but these errors were encountered: