the-dataface / figma2html

Export Figma frames as responsive HTML and CSS
https://www.figma.com/community/plugin/1109185297790825980/figma2html
MIT License
48 stars 8 forks source link

Duplicative styles on children #76

Open sawyerclick opened 1 year ago

sawyerclick commented 1 year ago

what's wrong Child elements should not duplicate explicit styles.

There are several instances where inherited styles are explicitly stated. This baloons file size and makes it hard to quickly parse the inheritance chain.

The parent <p> tag's styling and the .f2h-text-0 styling:

Screen Shot 2023-01-17 at 1 38 31 PM

The elements:

Screen Shot 2023-01-17 at 1 34 19 PM

how to fix Output only unique styles to each element. This could be done by finding the difference between an Object of the CSS properties. You would check child against parent, and we could possibly make this recursive from child to nth-parent.

sawyerclick commented 1 year ago

This should happen in ConvertTextFrames.ts, where we do a check currently to see if the styles for the root is totally equal to the current text element