-
Notifications
You must be signed in to change notification settings - Fork 555
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
expand=true results in no typography for Flutter #1334
Comments
This is because you have a filter that filters only for tokens that are of type "typography", however, when you expand your typography tokens they all get their own token types e.g. "fontFamily". So by expanding your typography tokens, the dictionary will no longer have any typography tokens, so then using your filter it leads to empty output and no output file being generated. |
Thanks @jorenbroekema - that's very helpful! However, once I do this I get the file contents below - this contains all of the colors and sizes from the files listed in "source". Is there no way to restrict processing to items from the source where "$type"==="typography" while letting the output values end up in the file regardless of their type? The other thing is that this outputs a Dart file that cannot be compiled because the strings are unquoted. Is that a known issue?
|
I'm not really sure I understand what you mean there, can you clarify? Do you want to filter the output for only tokens that used to be typography tokens?
I don't recall seeing an issue for this in this repository, and I don't personally know Dart. If it cannot be compiled then yeah that should probably be fixed, feel free to raise an issue or a pull request with the fix |
You've got it - I want to filter the input tokens so I can have them go into separate files. This would be regardless of whether they are "expanded" or only a single token is output. So, if there are three definitions in my file:
I'm looking for a way to have the separate output file for typography contain only:
And to NOT contain:
I'll create another issue for the Dart code being unquoted. Thanks again for your help! |
You'll have to add a custom filter that filters only for the typography expanded types but some of those types will be dimension (e.g. for fontSize) so it's actually really hard right now to filter on the token type "before" expansion... At some point I created a PR to add metadata to tokens about what type they were before expansion but I closed it because I didn't really see a good use case for it. But now we have one it seems. #1269 I'll probably reopen this |
Turning on expand=true makes it so no typography file is generated. I'm using the W3C syntax (e.g. $type).
Am I misunderstanding how 'expand' works?
Running config.json generates:
I'll need those [object Object] values expanded, so I tried adding
"expand":true
. At which point it refuses to generate anything.Here are my files:
config-expand-true.json
config.json
text.styles.tokens.json
The text was updated successfully, but these errors were encountered: