-
Notifications
You must be signed in to change notification settings - Fork 7
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
Extract variable rest api #29
Draft
origami-z
wants to merge
20
commits into
main
Choose a base branch
from
extract-variable-rest-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
origami-z
force-pushed
the
extract-variable-rest-api
branch
from
January 11, 2024 09:59
9a3b71d
to
0bb42e5
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Demonstrate the workflow to extract variables from Figma REST API, then use StyleDictionary to generate cross-platform style output (with some modification of data detailed below).
Below 2 env variables are needed for the code to run (in
.env
file)FIGMA_FILE_ID
, click the share button in Figma, get the id after/file/
FIGMA_ACCESS_TOKEN
, see Figma doc to generateThe script (
src/index.js
) covers:callFigmaAPI
(requiresFIGMA_FILE_ID
andFIGMA_ACCESS_TOKEN
present as env variables) or load from a local cached versionloadLocalMockData
updateApiResponse
filters remote variables and appends "/default" to any variable name which also served as a nested group name (not supported by StyleDictionary mentioned here)writeTokensToFile
writes tokens into tokens output folder, which is grouped by each folder and mode names like belowbuildUsingStyleDictionary
usesstyle-dictionary-utils
to parse token data using design tokens draft spec format and output end result, e.g. CSS variables and iOS Swift file.Given tokens are grouped in folders (in step 3), common tokens can be consumed and referenced. e.g. If light and dark modes both reference a common color palette (defined in a different collection), both mode build pipelines can consume the same common
source
.Previous experiment from Salt: jpmorganchase/salt-ds#58.
Additional notes
#### Style Dictionary
prefix
in platform config, but it can be used to prefix DS name, e.g. "salt". Seename/cti/kebab
in code.attribute/cti
) relies on token name location, likely we will need a different attribute system-default
css/variables
format, when usingoutputReferences
, and doc on Custom format with output referencesGrey/600/40A
will becomevar(--grey-600-40-a)