CSS Custom Properties This template is dedicated for Web developers using CSS. It helps you generate all types of design tokens as CSS Custom Properties in their respective CSS file.
This example uses four different parsers:
filter to target on a specific collection named "Colors" that contains our colors
change-case to change the name of our tokens and modes to kebabCase
This template is an example among others. Head toward the to-css-custom-properties page to get all available options.
CLI configuration
When using the CLI, you need to fill three properties:
repository
is @organization/repository
rules
lets you transform tokens by chaining parsers
Copy {
"version" : "2" ,
"repository" : "@organization/repository" ,
"personalAccessToken" : "<your-personal-access-token>" ,
"rules" : [
{
"name" : "css" ,
"parsers" : [
{
"name" : "filter" ,
"options" : {
"query" : {
"where" : {
"collection" : "Colors" ,
"select" : {
"parents" : true ,
"children" : true
}
}
}
}
} ,
{
"name" : "convert-color" ,
"options" : {
"toFormat" : "hsl" ,
"applyTo" : {
"collection" : true
}
}
} ,
{
"name" : "change-case" ,
"options" : {
"change" : "names" ,
"toCase" : "kebabCase" ,
"applyTo" : {
"collection" : true
}
}
} ,
{
"name" : "change-case" ,
"options" : {
"change" : "modes" ,
"toCase" : "kebabCase" ,
"applyTo" : {
"collection" : true
}
}
} ,
{
"name" : "to-css-custom-properties" ,
"output" : {
"type" : "file" ,
"filePath" : "tokens.css"
}
}
]
}
]
}
GitHub configuration
If you use the GitHub, you need to fill two properties:
repository
is @organization/repository
rules
lets you transform tokens by chaining parsers
Make sure you have connected your GitHub account with your Specify account. Head toward this article to learn more.
Copy {
"version" : "2" ,
"repository" : "@organization/repository" ,
"rules" : [
{
"name" : "css" ,
"parsers" : [
{
"name" : "filter" ,
"options" : {
"query" : {
"where" : {
"collection" : "Colors" ,
"select" : {
"parents" : true ,
"children" : true
}
}
}
}
} ,
{
"name" : "convert-color" ,
"options" : {
"toFormat" : "hsl" ,
"applyTo" : {
"collection" : true
}
}
} ,
{
"name" : "change-case" ,
"options" : {
"change" : "names" ,
"toCase" : "kebabCase" ,
"applyTo" : {
"collection" : true
}
}
} ,
{
"name" : "change-case" ,
"options" : {
"change" : "modes" ,
"toCase" : "kebabCase" ,
"applyTo" : {
"collection" : true
}
}
} ,
{
"name" : "to-css-custom-properties" ,
"output" : {
"type" : "file" ,
"filePath" : "tokens.css"
}
}
]
}
]
}