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

Platform-specific overrides #6

Closed
TravisSpomer opened this issue Aug 25, 2020 · 2 comments
Closed

Platform-specific overrides #6

TravisSpomer opened this issue Aug 25, 2020 · 2 comments
Assignees
Labels
export Platform-specific export concerns feature New feature or request

Comments

@TravisSpomer
Copy link
Member

We need a way to have tokens that are only exported for specific platforms, and for some tokens to have different values on each platform. We'd want to use this sparingly, but it's going to be unavoidable in some cases. e.g.:

  • There are platform-specific concepts like the Apple SegmentedControl (basically, their tabstrip) that we might want to restyle on Apple platforms, but not even export for Windows and CSS, since that control doesn't exist elsewhere.
  • At the lower end of the corner radii spectrum we're consistent across platforms, but we want to slightly modify the larger radii on some platforms to fit better with the platform's visual style.

This would probably work just by adding some kind of platform node to certain tokens that would signify that all platforms other than the specified ones should ignore that node and its children. There could also be a way to specify the reverse, such as exceptPlatform. For example:

"SegmentedControl" : {
  "platform": [ "mac", "ios" ],
  "Root": {
    "Fill": { /* ... */ }
  }
  /* ... */
}
@TravisSpomer TravisSpomer added feature New feature or request export Platform-specific export concerns labels Aug 25, 2020
@TravisSpomer TravisSpomer self-assigned this Oct 2, 2020
@TravisSpomer
Copy link
Member Author

This is nearly finished in the platform-overrides branch.

  • Currently in that branch, it uses the WinUI overrides for all platforms; I need to make it actually platform-specific
    • This is yet another thing that's not possible with a standard Style Dictionary config, so I'll first need to change how we build the platform outputs
  • winui is the only supported platform override; I need to add others
  • I didn't build a way to exclude a set of tokens from the output for a specific platform; I'll need to open a new issue to track that in case it's needed
  • Update documentation

@TravisSpomer
Copy link
Member Author

This is now working as of this commit. I still need to write documentation for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
export Platform-specific export concerns feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant