Configuration file 101

Learn more about how to setup your Specify configuration file to generate design tokens and assets fitting your company standards.

Introduction

Whenever you want to work with the GitHub or the Specify CLI destination, you need to create a Configuration file to instruct the Parsers Engine how to transform your design data, so it generate tokens that match your technical requirements.

A configuration file helps you:

  1. request design tokens and assets from a Specify repository

  2. transform them to fit your company standards thanks to parsers

Properties

A configuration is composed of 3 main properties:

  • repository

  • personalAccessToken

  • rules

Repository

The name of the Specify repository you want to pull your design tokens and assets from.

Let's say we have the following repository in Specify called "all-design-data" located in the "@acme-inc" organization.

An example Specify repository called "all-design-data-v2" located in the "@acme-inc" organization.

We target it like this:

circle-info

You can only target one repository per configuration file. Want to pull design tokens from several Specify repositories? Create several configuration files and run them with the Specify CLI (See example scriptarrow-up-right).

Personal Access Token

The Specify personalAccessToken used to authenticate you.

circle-info

Need a personal access token? Generate one ↗arrow-up-right

Parser Rules

The Parsers Rules help you transform your design tokens and assets the way you want.

You can have as many rules as you want and you can have rules that transform several Token types at once.

circle-info

Looking for the rules configuration? 👉 review the Parser Rule reference.

Here are different kind of rules and parsers you can use to generate color tokens as CSS Custom Properties:

  1. filterarrow-up-right to target on a specific collection named "Colors" that contains our colors

  2. convert-colorarrow-up-right to convert our colors in HSL

  3. change-case to change the name of our tokens and modes to kebabCase

  4. to-css-custom-propertiesarrow-up-right to generate a CSS file containing our tokens

Examples

How to run these examples

The following examples are made to be used with the Specify CLI.

Requirements:

Run all examples by copying the code and running the specify pull command.

Basic

Here's a basic configuration file that targets a Specify repository called design-system from the @acme-inc organization:

This example config file will return a colors.css file containing all design tokens stored in the design-system repository.

Here's an example of a token value returned by Specify:

Pull colors as CSS Custom Properties

Now let's update our previous configuration to only pull colors and transform them as CSS Custom Properties in RGB.

Here is the input returned by Specify and the output generated by Specify after executing our configuration.

Last updated

Was this helpful?