Draft
Conversation
9a3b71d to
0bb42e5
Compare
This file contains hidden or 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
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
.envfile)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_IDandFIGMA_ACCESS_TOKENpresent as env variables) or load from a local cached versionloadLocalMockDataupdateApiResponsefilters remote variables and appends "/default" to any variable name which also served as a nested group name (not supported by StyleDictionary mentioned here)writeTokensToFilewrites tokens into tokens output folder, which is grouped by each folder and mode names like belowbuildUsingStyleDictionaryusesstyle-dictionary-utilsto 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
prefixin platform config, but it can be used to prefix DS name, e.g. "salt". Seename/cti/kebabin code.attribute/cti) relies on token name location, likely we will need a different attribute system-defaultcss/variablesformat, when usingoutputReferences, and doc on Custom format with output referencesGrey/600/40Awill becomevar(--grey-600-40-a)