Totally agree with you it feels roundabout. The really challenging part was converting the computed styles to output that is as human-friendly as possible. And what's interesting these days: human-friendly means LLM-friendly...
We do a few optimizations to make it as human-friendly as possible. Details in the blog post linked above, but to summarize:
1. We abstract global styles — don't want to include boxSizing: 'border-box' on every div!
2. Remove inherited styles — no need to have styles that are already inherited from the parent.
3. Pull out SVGs — lots of icons on the internet, which can just be their own imports.
4. Condense padding, margin, border to their shorthand properties
We do a few optimizations to make it as human-friendly as possible. Details in the blog post linked above, but to summarize:
1. We abstract global styles — don't want to include boxSizing: 'border-box' on every div! 2. Remove inherited styles — no need to have styles that are already inherited from the parent. 3. Pull out SVGs — lots of icons on the internet, which can just be their own imports. 4. Condense padding, margin, border to their shorthand properties