Variables configuration

Learn how to use the command-line interface (CLI) config file to personalize and override the default behavior of the CLI Figma variables generation.

Available variables settings

With your config files, you can override the settings for:

To configure and override the default behavior of the CLI commands you use, we recommend you create a zeytal.json file in your project’s root directory.

To learn about the basics of Zeytal’s config files, see the CLI config files docs.

Directory path

Type: string

Default value: ".zeytal/variables"

This is the directory path into which your transformed variables will be written. This path is relative to your CWD.

zeytal.json

{ "variables": { "directoryPath": "styles/ds-variables" } }

In the example above, all the generated variable files will be written into "styles/ds-variables" instead of ".zeytal/variables".

Collections ignore prefix

Type: string

Default value: ""

If set, Figma variable collections starting with the chosen collectionsIgnorePrefix value will be ignored when generating variable files.

zeytal.json

{ "variables": { "collectionsIgnorePrefix": "_" } }

In the example above, all the Figma variable collections prefixed with _ are ignored and won’t be generated.

Output formats

Type: Array<"tw", "ts" | "esm" | "cjs" | "json" | "css" | "scss" | "sass" | "less">

Default value: []

This setting controls the format of your generated variables files.

zeytal.json

{ "variables": { "formats": { "targets": ["tw", "ts"] } } }

In the example above, all the extracted Figma variables will be generated into TailwindCSS, and TypeScript files.

For more info about the TailwindCSS config file generation, see the TailwindCSS config docs.

Colors format

Available options: "hex", "rgba", "hsla"

Default value: "hex"

This setting controls the color format in which your color variables are generated.

zeytal.json

{ "variables": { "formats": { "colors": { "format": "rgba" } } } }

In the example above, all generated color variables will be formatted to rgba.

Numbers format

Type: Array<{ mapping: string[]; unit: "px"|"rem"; noUnitClone?: boolean; }>

Default value: []

This setting specifies the number format in which some of your number variables will be generated. This is useful for targeting and formatting specific variables, such as font size, letter spacing, line height variables, etc.

Numbers format mapping

The mapping property allows you to target specific variables by name through an array of strings. The matching variables will be formatted based on the provided unit.

Numbers format unit

The variables matching your mapping strings will be formatted in the provided unit.

Numbers format noUnitClone

Sometimes you’ll need your variable values both with and without units. Use noUnitClone to duplicate targeted variables without units.

Cloned variables use the prefix var-no_u- instead of just var-.

zeytal.json

{ "variables": { "formats": { "numbers": { "format": [ { "mapping": ["font-size-", "letter-spacing-", "line-height-"], "unit": "rem", "noUnitClone": true } ] } } } }

In the example above, all generated variables with a name matching font-size-, letter-spacing-, or line-height- will be formatted to rem and come with a unitless clone of themselves.

Code example

A complete code example is available in the code examples section of our docs.

Go to code example

Config defaults

zeytal.json

{ "variables": { "directoryPath": ".zeytal/variables", "collectionsIgnorePrefix": "", "formats": { "targets": ["ts", "css"], "colors": { "format": "hex" }, "numbers": { "format": [] } } } }