Skip to content
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

Add support for variable references in output #17

Closed
dbanksdesign opened this issue Mar 3, 2017 · 7 comments
Closed

Add support for variable references in output #17

dbanksdesign opened this issue Mar 3, 2017 · 7 comments
Labels
Core Architecture This is an issue related to the core architecture of Style Dictionary enhancement
Projects
Milestone

Comments

@dbanksdesign
Copy link
Member

This would be useful to see reference chain in the generated files. Although would need to only be used for files that have all properties in them or there might be errors.

@chazzmoney chazzmoney added the Core Architecture This is an issue related to the core architecture of Style Dictionary label Jun 6, 2018
@chazzmoney chazzmoney changed the title Add support for variable references Add support for variable references in output Jun 6, 2018
@chazzmoney
Copy link
Collaborator

The question here is whether this is a use case that we see as being valuable. It isn't quite on the path of "enable end-to-end consistency of design atoms across platforms / deliverables.

@sarahbethfederman
Copy link

I would definitely find this useful for use in supporting tooling. I would love to have a vscode plugin that shows the reference chain on hover when using a token

@didoo
Copy link
Contributor

didoo commented May 15, 2019

Let's keep in mind also that a token "A" can reference as "alias" another token, let's say "B", who can reference another token, "C" , who can reference another token, "D", who finally references a key/value pair, let's say "XYZ / 12px". In that case, which one is the reference to show for "A"? "B" or "XYZ" ?

@chazzmoney
Copy link
Collaborator

Or do we want to show the entire chain?

XYZ, D, C, B, A

@dbanksdesign
Copy link
Member Author

The issue in showing the entire chain in the output like this:

$A: $B;
$B: $C;
$C: $D;
$D: $XYZ;
$XYZ: 12px;

Is that file would need to include all tokens to ensure the file is valid. Or if we don't we at least need to make sure the full variable chain is there, but to also not duplicate variable definitions or that might cause issues.

Now a VSCode plugin that shows the reference chain in a style dictionary...

@lukasoppermann
Copy link
Contributor

If I understand this correctly, it would mean in css I would have:

--core-primary-color: #0022AA;
/*...*/
--interactive-color: var(--core-primary-color);
/*...*/
--button-color-primary: var(--interactive-color);

This would be very helpful for the goal of building a somewhat "self-documenting" and human readable system. Since the idea of design tokens is to provide named entities and bring meaning into the whole mess, I'd argue a referenced variable is very valuable. It helps me to understand why this color is used for the button color, vs. just --button-color-primary: #0022AA

@dbanksdesign dbanksdesign moved this from To do to Done in SD 3.0 Feb 11, 2021
@dbanksdesign
Copy link
Member Author

This is in 3.0 and you can get it today with npm install style-dictionary@next. For users of the future, this feature is available in Style Dictionary starting with 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Architecture This is an issue related to the core architecture of Style Dictionary enhancement
Projects
No open projects
SD 3.0
  
Done
Development

No branches or pull requests

5 participants