-
Notifications
You must be signed in to change notification settings - Fork 553
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
feat(format): output references #504
Conversation
WOOHOO! #17 |
I really like that this empowers people on the route of #268, which is something that I have wanted for SD for a LONG time (even well before I created that issue). I think it is super valuable that people can customize SD for how they think about tokens. It fits our usually conflicting goals: simply to use; fully customizable / working how people want or expect; enable and encourage people to build in a manner that organizes their thinking (use both base/defining properties and use-case/output properties). This also enables client-side/end-platform tools to have strong access to the underlying reference structure that powers SD which is a huge plus. Really really excited about this one. |
Three improvements to consider:
|
Also... we should probably update all default formats to use variables where appropriate. It will be a lot of work, but it is weird to include this without updating all of them. |
return; | ||
} | ||
|
||
for (i = 0; i < path.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that it's been decided to move away from lodash, and the "utils" folder has started to contain lodash-like functions, do you think we should isolate this as deepFind
function there?
First of all, amazing PR @dbanksdesign, really great idea 🙌. Now, I did a quick code review and added a few comments there. I have some other thoughts here:
Let me know if I can help somehow on this. |
@dbanksdesign there may be a chance I need to use this in one of our projects. Is there a way I can help on this one (other reviews, code refactoring, add tests, etc?) so it gets approved and merged? |
Co-authored-by: Cristiano Rastelli <public@didoo.net>
Co-authored-by: Cristiano Rastelli <public@didoo.net>
@didoo I would love some help with this! I think we need some more tests, more documentation, and updating applicable formats to use this new code. Whichever you'd like to help out on would be greatly appreciated. I also have some time tomorrow I can spend on this and you can take a look. |
* fix(extend): use given file path for token data * docs(properties): update properties doc to reflect new additions * docs(property): adding default metadata to property docs * docs(properties): adding more context to default metadata * docs(properties): cleaning up default metadata docs
Adds basePxFontSize platform option which allows you to set the base px font size for pixel transforms. The default remains the same, 16.
…Props keys (#501) These descriptions are based on the `Default property metadata` section in the `Properties` docs.
Note: This is a breaking change as it changes the behavior of SD from 2.x
Big update:
|
Another update:
|
--color-danger: var(--color-red); | ||
--color-error: var(--color-danger); | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this as an example. You might contrast it with what happens if outputReferences is false.
Nice work. Seriously. LGTM! |
Update:
|
@dbanksdesign {
"color": {
"background": {
"primary": {
"value": "{color.palette.neutral.0.value}" ,
"fallback":"red"
}
}
}
} tokens output: /** simple css var */
--color-background-primary: var(--my-var, red);
/* complex var may not be necessary to be implemented */
--color-background-primary: var(--my-var, var(--my-background, pink)); #544 this issue seems similar. It seems that I have to write custom format. |
Issue #, if available: #17 #396
Description of changes: Allow for variable references in output files. These changes will make it easier to use the name of a referenced token rather than the resolved value, so the output will keep the aliases/references intact.
resolveReference()
andusesReference()
methods on the dictionary object that is passed to formats and actions. This will allow custom formats and actions to test and resolve references the same way style dictionary does internally, allowing you to get the transformed name of a token for instance.outputReferences
configuration on SCSS, CSS, and Less variables, as well asios/class.swift
,flutter/class.dart
, andandroid/resources
formats to make use of thisBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.