Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
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.
A collection will generate a folder at the top level
The default level refers to the SDTF Token Type associated SD Category → {collectionName?}
/{SDCategory}
The next folder level is the name of the potential first group containing the token → {collectionName?}
/{SDCategory}
/{1stLevelGroupName?}
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: ... }}}}
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.
You must set a name and your desired output for each parser:
The name
is the name of the parser
The output
property indicates which type of output you want the parser to produce
Parsers support none, some or more output types, please refer to dedicated parser pages for details.
Use case: the parser is expected to produce exactly one file.
Directory
Use case: the parser is expected to produce 0 to N files, all placed in the given directoryPath
.
Example with the to-css-custom-properties
parser:
This parser helps you transform design tokens into CSS Custom Properties.
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
A design token can have modes, be nested in groups and be part of a collection. The following use case will generate a single CSS file containing core tokens and semantic tokens.
Head towards our templates section to see how you can use this parser with others to suit a common use case when working with CSS.
This parser helps you select design tokens from specific mode(s).
This parser helps you filter a SDTF graph.
Parameter | Required | Type | Default | Description |
---|
We want to get all tokens in all groups named "info"
We also want to get the parent
collection...
... and all children
tokens within the "info" group(s)
We eventually generate our transformed SDTF graph in a JSON file thanks to the to-sdtf
parser.
This parser helps you change the case of names or modes over a SDTF graph.
This example helps you transform in kebabCase
the name all collections, groups, tokens and modes. Use this example if you want to generate CSS Custom properties with the to-css-custom-properties
parser.
We change the case of the token names
and the modes
to kebabCase
. We applyTo the collection level so we transform in kebabCase
:
the collection names
the group names
the token names
the mode names
Parser | Description | Usage example |
---|---|---|
Parameter | Required | Type | Default | Description |
---|
We then generate our transformed SDTF graph in a JSON file thanks to the parser.
We then generate our transformed SDTF graph in a JSON file thanks to the parser.
Parameter | Required | Type | Default | Description |
---|
We eventually generate our transformed SDTF graph in a JSON file thanks to the parser.
This parser helps you change the case of names or modes over a SDTF graph.
This parser helps you convert the color formats of color compatible tokens over a SDTF graph.
This parser helps you filter a SDTF graph.
This parser helps you select design tokens from specific mode(s).
This parser helps you transform design tokens in CSS Custom Properties.
This parser helps you get your design tokens as a SDTF graph in JSON.
This parser helps you generate Style Dictionary raw token files for all your design tokens coming from Specify.
This parser helps you generate a Tailwind theme from all your design tokens coming from Specify.
This parser helps you pull design tokens as JavaScript objects for all token types and their respective getter functions.
This parser helps you pull design tokens in JSON with token values in JSON or CSS.
This parser helps you pull design tokens as TypeScript objects for all token types and their respective getter functions.
selectorTemplate
optional
string
The pattern used to generate the CSS selector name(s). It must match mustache template syntax.
You can use collection
, mode
and groups
names.
tokenNameTemplate
optional
string
The pattern used to generate token names. It must match mustache template syntax.
You can use collection
, mode
,groups
and token
names.
includeCoreTokensInScopes
optional
boolean
false
When set to true
, you will have both core tokens and alias tokens in each CSS scopes thus making alias tokens always resolvable.
| required |
| The query that select items in the graph. |
| required |
| optional |
| required |
| optional |
| optional |
| required |
|
| optional |
|
| Whether to resolve the aliases of the graph. Thus, preventing aliases to become unresolvable when their source is not included in the selected items. |
| optional |
|
| Whether to allow unresolvable aliases to flow through.
This option is only available when |
| optional |
|
| When you target tokens from different areas in your graph you can end up with tokens that will have the same name which will lead to an override. When set to |
| optional |
|
| By default, this parser mutates your graph. When set to |
| optional |
| Change the names or the modes of the selected items. |
| required |
| required |
The target color format to convert to. Actual value conversion is done by the package.
The selection where to apply the transformation.
collection
, group
, token
take a Regex string or true
to select anything of the kind.
An SDTFQuery
can be used for advance use cases. Learn more about .
The target color format to convert to. Actual value conversion is done by the package.
The selection where to apply the transformation.
collection
, group
, token
take a Regex string or true
to select anything of the kind.
An SDTFQuery
can be used for advance use cases. Learn more about .
The query that select items in the graph. Learn more about .
The case transformation to apply. Actual transform is done by the package.
The selection where to apply the transformation.
collection
, group
, token
take a Regex string or true
to select anything of the kind.
An SDTFQuery
can be used for advance use cases. Learn more about .