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

How do you deal with size values on different platforms #124

Closed
tomger opened this issue Oct 18, 2017 · 1 comment
Closed

How do you deal with size values on different platforms #124

tomger opened this issue Oct 18, 2017 · 1 comment

Comments

@tomger
Copy link
Contributor

tomger commented Oct 18, 2017

For Android I'd like the values to end in sp/dp.
On Web I'd like the values to end in px.
On iOS I'd like the values not to have a postfix, and be rendered as integers without quotes.

What's the recommended strategy? I'm trying to use the CLI and not write a custom formatter.

@aputinski
Copy link
Contributor

aputinski commented Oct 21, 2017

You can write custom value transforms:

theo.registerValueTransform(
  name: "AndroidUnit",
  predicate: (prop) => prop.get('type') === 'sizing', // or whatever criteria you'd like
  transform: (prop) => `${prop.get('value')}dp`
)

theo.registerTransform(
  name: 'Android',
  valueTransforms: ['AndroidUnit']
)

Then call run theo using the Android transform

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