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

Ref / Aliases don't work with slashes #231

Open
derekwsgray opened this issue Sep 22, 2022 · 3 comments
Open

Ref / Aliases don't work with slashes #231

derekwsgray opened this issue Sep 22, 2022 · 3 comments

Comments

@derekwsgray
Copy link
Contributor

derekwsgray commented Sep 22, 2022

For the Standard Draft, and for StyleDictionary, references/alias must use a 'dot' between groups/children.
However, for organizing styles in Figma, we are going to tend towards using slashes.

i.e. Where the designer creates a style named in Figma as color/grey-10, if they want to use the alias, they have to remember to use a different form of the name: color.grey-10. It would be nice if the Designer did not have to understand the implementation details of the plugin/specification to remember write it in this different way.

I suggest it accept both, but convert any slashes to dots on export.

@lukasoppermann
Copy link
Owner

Hmm, interesting idea. You mean the alias from the description?

Would you be able to send a PR for this?

@derekwsgray
Copy link
Contributor Author

Yes, the "ref:" or "alias: " lines in a Description of a colour style for example.
I can probably make a PR, but I can't find the unit test / test data that tests the extraction from the 'description' field. Or is there no test for that?

@lukasoppermann
Copy link
Owner

Hey, I think this is only tested via the integration tests. But I would be great if you could extract this into a separate function and ts file and test it.

The logic currently lives in the colors file, as it only works with colors atm (https://github.com/lukasoppermann/design-tokens/blob/main/src/extractor/extractColors.ts#L20-L39). If you want to extend this to work with all tokens that can have a description, that would also be nice.

Feel free to work on this in small chunks and send PRs for those, e.g. one pr just to "extract and test" the alias functionality. (Small PRs are easier to check and merge for me).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants