to-style-dictionary

This parser helps you generate Style Dictionary raw token files for all your design tokens coming from Specify.

Unlike the existing to-style-dictionary parser, this one doesn't have any options yet.

Interface

interface parser {
  name: 'to-style-dictionary';
  output: {
    type: 'directory';
    directoryPath: string;
  };
}

General output rules

  • A collection will generate a folder at the top level

    1. The default level refers to the SDTF Token Type associated SD Category → {collectionName?}/{SDCategory}

    2. The next folder level is the name of the potential first group containing the token → {collectionName?}/{SDCategory}/{1stLevelGroupName?}

    3. The default filename is the name of the first group, or the name of the each mode the token might have, or base.json{collectionName?}/{SDCategory}/{ mode? | 1stLevelGroupName? | base}.json (priority order for filename: groupName > mode > base)

  • The token path inside the file must match the token file path with the following priority order: collection > SDCategoryType > Mode > Groups

    • {collectionName?}/{SDCategory}/{1stLevelGroupName? | mode? | base}.json{ collection: {type: {mode: { groupName: { tokenName: ... }}}}

Basic usage

Last updated

Was this helpful?