Configuration
Learn more about how to configure Specify to generate design tokens and assets fitting your company standards.
Introduction
By default, without any parsers, Specify returns your design data as raw data:
Design tokens are returned in JSON
Assets are returned as files
A configuration file helps you:
request design tokens and assets from a Specify
repository
transform them to fit your company standards thanks to rules, token types and 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.
We target it like this:
You can only target one repository per configuration file. Want to pull design tokens from several Specify repositories? Create a several configuration files and run them with the Specify CLI.
Personal Access Token
The Specify personalAccessToken
used to authenticate your actions.
Need a personal access token? Generate one ↗
Rules
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.
A rule is composed of the following properties:
name
string
true
The name of your rule.
path
string
true
The path in your project where you want Specify to generate your design data.
If you want to pull bitmap, vector or font token types you must set a directory (Learn more ↗).
parsers
Array<Parser>
false
The parsers you want to apply to transform your Token types. For further details see Parsers.
Parsers
Parsers are functions allowing you to transform design tokens and assets coming from Specify to fit your needs and company standards.
Inside a configuration, a parser has the following properties:
options
false
The options relative to the parser you apply. Each parser has its own options you can find in their respective README file.
Example
Here's a rule named "Design Tokens" that:
targets
color
andmeasurement
design tokenssorts them alphabetically by their
name
transforms them as CSS Custom Properties
writes them in a
design-tokens.css
file inside astyles
folder
Examples
How to run these examples
The following examples are made to be used with the Specify CLI.
Requirements:
a Specify repository containing design tokens
a valid personal access token (Generate one ↗)
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 all-design-data
from the @acme-inc
organization:
This example config file will return a design-tokens.json
file containing all design tokens and assets stored in the all-design-data
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 HSL.
Here is the input returned by Specify and the output generated by Specify after executing our configuration.
Last updated