Learn more about how to configure Specify to generate design tokens and assets fitting your company standards.
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.
A configuration is composed of 3 main properties:
repository
personalAccessToken
rules
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.
The Specify personalAccessToken
used to authenticate your actions.
Need a personal access token? Generate one ↗
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:
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:
Here's a rule named "Design Tokens" that:
targets color
and measurement
design tokens
sorts them alphabetically by their name
transforms them as CSS Custom Properties
writes them in a design-tokens.css
file inside a styles
folder
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.
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:
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.
Name | Type | Required | Description |
---|---|---|---|
Name | Type | Required | Description |
---|---|---|---|
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 ↗).
filter
false
The list of Token type you want your rule to target.
parsers
Array<Parser>
false
The parsers you want to apply to transform your Token types. For further details see Parsers.
name
string
true
The name of the parser. Choose from all available parsers.
options
false
The options relative to the parser you apply. Each parser has its own options you can find in their respective README file.