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

Update Figma variables from JSON files #1884

Open
wants to merge 70 commits into
base: production
Choose a base branch
from
Open

Conversation

aweell
Copy link
Collaborator

@aweell aweell commented Sep 11, 2024

Description

This feature allows the creation of figma variables by running a script in the repository.

Screenshot 2024-09-16 at 10 30 55

https://www.tldraw.com/s/v2_c_snnVQbmyyGW4BzwXyXPwZ?d=v6816.-947.4025.2072.page

This script should:

  • Create a collection palette en each skin file
  • Create the collections Mode and Brand in a middleware file

This middleware file is the one that will be used to link variables in all Mistica components

Each collection will appear as a selector in the UI:

  • Brand: change the selection to one of the available brands
  • Mode: change the color mode to light or dark

Appart from the tokens defined in JSON files, we need to create figma-oriented tokens:

  • Font family: change the font-family per brand
  • Icon set: change the icon set used per brand

Test file with variables created:

https://www.figma.com/design/wlnMwpneZheC7CskSJAw4g/Middleware-POST-test-V2?node-id=0-1&node-type=canvas&t=scPU5BKt3mgO0tCf-0

tokens/figma/README.md Outdated Show resolved Hide resolved
tokens/figma/README.md Show resolved Hide resolved
Copy link
Collaborator

@yceballost yceballost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the last thing I can do in this PR is to make a clap 👏

branches:
- production
paths:
- "tokens/movistar.json"
Copy link

@marcoskolodny marcoskolodny Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use something like "tokens/**.json" or similar. This will prevent you from having to update this in the future by hand (https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this, if we for example add a new skin but we dont want to sync it with figma via script yet, the action will trigger when changes on that JSON are made, how we can avoid this?

Copy link
Collaborator

@yceballost yceballost Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add a new skin and we dont want to sync with Figma, just don't include as a "available" skin in .mjs script

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the end, we will keep "paths" for each brand.json file to avoid run the script with unofficial .json files

package.json Outdated Show resolved Hide resolved
@aweell aweell linked an issue Sep 26, 2024 that may be closed by this pull request
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.

Script to update variables via Figma API
3 participants