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:
request design tokens and assets from a Specify repository
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.
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 script).
Personal Access Token
The Specify personalAccessToken used to authenticate you.
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:
{"colors": {"$collection": {"$modes": ["Light","Dark" ] },"core": {"blue-100": {"$type":"color","$description":"token 1 aliased with n modes within collection within n groups","$value": {"Light": {"red":219,"blue":254,"alpha":1,"green":236,"model":"rgb" } } } } }}
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.
{"colors": {"$collection": { "$modes": ["Light","Dark"] },"core": {"blue-100": {"$type":"color","$description":"token 1 aliased with n modes within collection within n groups","$value": {"Light": {"red":219,"blue":254,"alpha":1,"green":236,"model":"rgb" },"Dark": {"red":41,"blue":67,"alpha":1,"green":52,"model":"rgb" } } },"blue-700": {"$type":"color","$description":"token 2 aliased with n modes within collection within n groups","$value": {"Light": {"red":17,"blue":249,"alpha":1,"green":125,"model":"rgb" },"Dark": {"red":96,"blue":250,"alpha":1,"green":168,"model":"rgb" } } } },"semantic": {"background": {"button": {"primary": {"hover": {"$type":"color","$description":"alias token with n modes within collection within n groups","$value": {"Dark": {"$mode":"dark","$alias":"colors.core.blue-100" },"Light": {"$mode":"light","$alias":"colors.core.blue-700" } } } } } } } }}