Style-dictionary: Aliasing objects at levels above value

Created on 27 Nov 2018  路  4Comments  路  Source: amzn/style-dictionary

What should happen if you try to reference a whole object that contains values?
What are the problems we are trying to solve with aliasing a whole object with values in it?

(#120, #198)

Core Architecture enhancement

Most helpful comment

I usually do pretty granular references for theming (e.g. button-background-color-primary: theme-background-color-accent). I haven鈥檛 thought much about object level references for theming but it would be interesting to explore what that means.

Properties that I do often reference in bunches include things like border width/style/color or shadow spread/blur/offset/color. I have to admit though, since moving to js modules instead of json files I just require the properties that I need using node and merge them into new property objects with JavaScript.

All 4 comments

I think that this could be useful for inheriting dictionaries or theming. @elliotdickison might have some thoughts?

I usually do pretty granular references for theming (e.g. button-background-color-primary: theme-background-color-accent). I haven鈥檛 thought much about object level references for theming but it would be interesting to explore what that means.

Properties that I do often reference in bunches include things like border width/style/color or shadow spread/blur/offset/color. I have to admit though, since moving to js modules instead of json files I just require the properties that I need using node and merge them into new property objects with JavaScript.

Since I am the one that raised over and over this question, I want to make clear that my problem is not that I want/need this feature, it depends on real user-needs and up to now (I agree with @elliotdickison, the only case where I needed this was for a font declaration, so family, size, line-height, etc).

My main concern was that it was not clear in the documentation if this was possible, and in that case how to use it, and what to expect as a result. If there are no real/important use cases, I prefer to keep the overall complexity of Style Dictionary lower, and clearly state in the documentation that this is not allowed (so the only valid references would be to the "value"). My 2 cents.

With the addition of #89, most use cases are likely covered by creating style dictionaries directly in javascript.

In the documentation on using alias/references in JSON property files, we do say this:

Note that this only applies to values; referencing a non-value property will cause unexpected results in your output.

Maybe we should be more clear?

In any case, we aren't considering adding this functionality at this time. If you stumble upon this issue and have a use case that requires it, please open a new issue that references this one and we can look at adding it in.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blackfalcon picture blackfalcon  路  4Comments

sarah-martinellibenedetti picture sarah-martinellibenedetti  路  4Comments

dbanksdesign picture dbanksdesign  路  5Comments

tonyjwalt picture tonyjwalt  路  5Comments

chemoish picture chemoish  路  3Comments