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

Make transitive transforms & resolves possible #371

Merged
merged 1 commit into from
Oct 12, 2020
Merged

Make transitive transforms & resolves possible #371

merged 1 commit into from
Oct 12, 2020

Conversation

mfal
Copy link
Contributor

@mfal mfal commented Jan 10, 2020

Issue #208

Transformations can only be executed, if the value to be transformed, has no references in it. So resolving may lead to enable further transformations, and sub sequent resolving may enable even more transformations - and so on.

Unfortunately the current implementation only transforms and resolves once, and transformation on values containing references do not work. This change enables this transitive dependencies, by executing "transform & resolve" until all transformations are executed.

Take the following example (the color: {...} object might setup your custom color transformation)

color.brand = {
  value: "{color.base.green}"
}

color.background.button.primary.base = {
  value: "{color.brand.value}",
  color: {
    desaturate: 0.5
  }
}

color.background.button.primary.hover = {
  value: "{color.background.button.primary.base}",
  color: {
    darken: 0.2
  }
}

As you can see color.background.button.primary.hover is a variation of color.background.button.primary.base which is a variation of color.base.green. This transitive dependencies are solved by running this loop.

@mfal mfal changed the title Make transitive transforms & resolves possible WIP: Make transitive transforms & resolves possible Jan 11, 2020
@mfal mfal changed the title WIP: Make transitive transforms & resolves possible Make transitive transforms & resolves possible Jan 13, 2020
Transformations can only be executed, if the value to be transformed, has no references in it. So resolving may lead to enable further transformations, and sub sequent resolving may enable even more transformations - and so on. This change enables this transitive dependencies.

Fixes #208
@dbanksdesign
Copy link
Member

Thank you for submitting this! This is a pretty big PR, it'll take some time to review. Please have some patience on this.

@chazzmoney chazzmoney changed the base branch from master to 3.0 September 21, 2020 22:47
@dbanksdesign
Copy link
Member

Hey @mfal ! Sorry it took so long to get to this, it has been a busy few months. I finally dug into this PR and we are super excited to get this into the next major release (3.0). I made some changes/proposals and created a pull request on your branch, https://github.com/mfal/style-dictionary/pull/1. Let me know what you think and when that gets merged in, this PR should automatically update and we can merge it in. Let me know if you have any questions/concerns.

Thank you so much for this contribution!

@chazzmoney chazzmoney merged commit 3edbb17 into amzn:3.0 Oct 12, 2020
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

Successfully merging this pull request may close these issues.

3 participants