yagudaev / figma-to-json

💾 Read/Write Figma Files as JSON
https://figma2json.com
MIT License
199 stars 27 forks source link

Hierarchical structures are supported. #10

Open whxcode opened 2 years ago

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
figma-to-json ❌ Failed (Inspect) Oct 10, 2022 at 3:12AM (UTC)
yagudaev commented 2 years ago

Hi Wang, thanks for the PR 😁.

From what I can tell, you are trying to convert the Event-based model that the .fig file uses to the snapshot-based model that Figma Rest API and Figma Plugin API use.

The best way to do this is to do a redux-like reducer structure.

(state, action) => state, then run each event and compute the snapshot.

I wanted to leave the original read of the .fig file very raw without any modification. This conversion process is super valuable and I'll certainly look at your PR for inspiration 😁.

whxcode commented 2 years ago

Hi Wang, thanks for the PR grin.

From what I can tell, you are trying to convert the Event-based model that the .fig file uses to the snapshot-based model that Figma Rest API and Figma Plugin API use.

The best way to do this is to do a redux-like reducer structure.

(state, action) => state, then run each event and compute the snapshot.

I wanted to leave the original read of the .fig file very raw without any modification. This conversion process is super valuable and I'll certainly look at your PR for inspiration grin.

Thanks for your advice.

The cover of the file can be obtained. image

This way you can get information about the file. image

As for my previous question, I didn't study it carefully. https://github.com/yagudaev/figma-to-json/issues/9. Image information may be stored in "unzipped" objects. image image

Best regards, Wang.

yagudaev commented 8 months ago

Brilliant work, @whxcode. Thanks so much for the info 🤩.