The command line tool requires a configuration manifest file to generate source code. The configuration manifest has the following parameters:
input
: The path to the input design token files. (optional)output
: The path to the directory where the output should be generated. (optional)colors
: The tool will generate outputs for any color tokens in the design tokens JSON.input
: The path to the input design token files. (default: globalinput
)output
: The path of the directory where the output should be generated. (default: globaloutput
)
dimensions
: The tool will generate outputs for any dimension tokens in the design tokens JSON.input
: The path to the input design token files. (default: globalinput
)output
: The path of the directory where the output should be generated. (default: globaloutput
)
numbers
: The tool will generate outputs for any number tokens in the design tokens JSON.input
: The path to the input design token files. (default: globalinput
)output
: The path of the directory where the output should be generated. (default: globaloutput
)
gradients
: The tool will generate outputs for any gradient tokens in the design tokens JSON. Requiresnumbers
to be set.input
: The path to the input design token files. (default: globalinput
)output
: The path of the directory where the output should be generated. (default: globaloutput
)
The following manifest configures the command line tool to generate tokens from a single design tokens file, all in the same directory.
{
"input": "design-tokens.json",
"output": "Output/",
"colors": {}
}
The following manifest configures the command line tool to generate tokens from multiple design tokens files, in different directories.
{
"colors": {
"input": "design-tokens-colors.json",
"output": "Output/Colors/"
}
}
Specific token configurations can inherit the global input, or output, if no specific one is provided.
{
"input": "design-tokens.json",
"output": "Output/",
"colors": {
"input": "design-tokens-colors.json",
"output": "Output/Colors/"
},
"dimensions": {}
}
In this case, the dimension tokens will use the design-tokens.json
input file, and source code will be generated in the Output/
directory.
Multiple inputs can be provided globally, or for each token-specific configuration.
{
"output": "Output/",
"colors": {
"input": [
"design-tokens-color-foundations.json",
"design-tokens-color-brand.json"
],
"output": "Output/Colors/"
}
}
If no input, or output is specified in the manifest, the generation process will fail.