-
Notifications
You must be signed in to change notification settings - Fork 567
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
Referencing alias without generating #327
Comments
Right now no. Style Dictionary merges all the source files together into 1 big object before any alias resolution happens. Then filtering is the way to remove tokens from the output files. If you have any ideas on how we can make this better we would love to hear it! |
Danny, I think about two ideas :
{
value: '#fef1cc',
original: { value: '#fef1cc' },
name: 'SecondaryYellow200',
attributes:
{ category: 'secondary',
type: 'yellow',
item: '200',
subitem: undefined,
state: undefined
},
path: [ 'secondary', 'yellow', '200' ]
} IMO, if we add the file path where the property comes from or add the fact that the prop is an include instead of a source (adding the two, will be really awesome 😁) will help filter more correctly than it is possible for now.
I hope it will help you improve this project. |
Thank you so much for the suggestions. I like the first idea, especially adding if a token was in 'include' or 'source'. The thinking behind 'include' and 'source' is for creating parent-child style dictionaries. In my team at Amazon, we have a core style dictionary that both web and mobile inherit from, core is the parent and web and mobile are children. The mobile and web style dictionaries 'include' the tokens from core, and have their 'source' as any additions/overrides. One of the differences between 'include' and 'source' is that Style Dictionary will warn you (or throw an error depending on the log type) if 2 files found in 'source' would override parts of the object, but it won't if a file in 'source' overrides something in 'include' as that is what is intended. Hopefully that helps! |
Thank you for your detailed explanation 😊 I had not imagined this use for my project but it's really interesting. Do you want me to open a PR or do you add this change yourself? |
If you would like to open a PR that would be great! Just to confirm, that PR would add file path and if the token was from 'include' or 'source' onto each token. If you could add test cases to verify the functionality that would be greatly appreciated, and take a quick glance at the contributing guidelines. Thanks! |
+1 |
@7studio I really like this suggestion. Would love to add it to the project - are you still working on the PR? Do you have any questions? |
Hi Charles,
If someone has any piece of advice to help me in this work I will be happy to read them 😊 Xavier. |
All extend tests fail? That is really odd.. maybe when you are ready post a PR with tests failing and we can take a look. For the property names what about Thank you for your work on this! |
This is probably one of the first features I was looking for. |
This is in 3.0 and available today with |
Hi,
Is there a way to include/reference alias without generating entries into output files?
I don't find any solution into documentation, examples or different projects which use Style Dictionnary to load JSON and assign them like alias without
include
orsource
.At this time, I manage to get what I need with the help of
filter
by excluding tokens with someprop.path
but it's very untenable.Thank you for you help.
Xavier.
The text was updated successfully, but these errors were encountered: