Parsers

Parsers are functions allowing you to transform design tokens and assets coming from Specify to fit your needs and company standards.

Not familiar with parsers? Head over to the existing parsers documentation and learn more about why you need them and how to use them.

We're currently working on making our existing parsers compatible with the SDTF. We'll update this page accordingly.

General properties

You must set a name and your desired output for each parser:

  1. The name is the name of the parser

  2. The output property indicates which type of output you want the parser to produce

Output types

Parsers support none, some or more output types, please refer to dedicated parser pages for details.

File

Use case: the parser is expected to produce exactly one file.

type FileOutput = {
  type: 'file';
  filePath: string;
}

Directory

Use case: the parser is expected to produce 0 to N files, all placed in the given directoryPath.

type DirectoryOutput = {
  type: 'directory';
  directoryPath: string;
}

Example with the to-css-custom-properties parser:

"parsers": [
  {
    "name": "to-css-custom-properties",
    "output": {
      "type": "file",
      "filePath": "style.css"
    }
  }
  // ...
]

Available parsers

Last updated