arrow-left
All pages
gitbookPowered by GitBook
1 of 1

Loading...

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:

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

  • convert-colorarrow-up-right to convert our colors in HSL

  • to change the name of our tokens and modes to kebabCase

  • to generate a CSS file containing our tokens

This template is an example among others. Head toward the page to get all available options.

hashtag
CLI configuration

When using the CLI, you need to fill three properties:

  • repository is @organization/repository

  • personalAccessToken which you can generate

hashtag
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

circle-info

Make sure you have connected your GitHub account with your Specify account. Head toward to learn more.

rules lets you transform tokens by chaining parsers
change-case
to-css-custom-propertiesarrow-up-right
to-css-custom-propertiesarrow-up-right
in your account settingsarrow-up-right
this articlearrow-up-right
{
  "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"
          }
        }
      ]
    }
  ]
}
{
  "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"
          }
        }
      ]
    }
  ]
}