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

apply fallback variable if no connected variable #2782

Merged
merged 1 commit into from
May 30, 2024

Conversation

six7
Copy link
Collaborator

@six7 six7 commented May 20, 2024

Closes #2794

Why does this PR exist?

When a token is not connected to a variable, but the value of the token is a pure reference to a token that is connected to a variable, apply that variable, instead of what we do today, which is apply the raw hex value.

This enables users to have their semantic variables applied when their component tokens are applied - as long as they dont create component token variables.

What does this pull request do?

Adds a check to where we fetch the variableReference if there's a fallback variable we could use

Testing this change

  • Create a token called red in a set called Core, create a theme group for it and enable just that set here
  • Create another token called danger and use {red} as the value, in another set called Semantic (no theme group required)
  • Create variables
  • Apply the token for danger and see that red variable is applied

Copy link

changeset-bot bot commented May 20, 2024

🦋 Changeset detected

Latest commit: 894d36f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tokens-studio/figma-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@six7 six7 marked this pull request as ready for review May 27, 2024 19:11
@six7 six7 linked an issue May 27, 2024 that may be closed by this pull request
@six7 six7 merged commit 483c526 into release-139 May 30, 2024
5 of 6 checks passed
@six7 six7 deleted the six7/apply-fallback-variable-if-pure-reference branch May 30, 2024 08:21
@six7 six7 added the 2.0-rc7 label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If no variable exists for token, try to apply the reference
2 participants