The Resolver
What Is the Resolver?
Section titled “What Is the Resolver?”The Resolver is a DTCG 2025.10 document that specifies how tokens are assembled. It defines which token files load, in what order, and how themes, platforms, or densities overlay them. Dispersa consumes resolver documents to produce the final token set.
Document Structure
Section titled “Document Structure”Start with the spec version:
{ "version": "2025.10"}Then add sets, modifiers, and resolutionOrder.
Sets are named groups of token sources. Each set has a sources array pointing to token files or inline token objects. Sets are the base building blocks.
{ "sets": { "core": { "sources": [ { "$ref": "./tokens/colors.json" }, { "$ref": "./tokens/spacing.json" } ] } }}Modifiers
Section titled “Modifiers”Modifiers define contextual variations: themes, platforms, densities. Each modifier has contexts mapping context names to token sources, and an optional default.
{ "modifiers": { "theme": { "default": "light", "contexts": { "light": [{ "$ref": "./tokens/theme-light.json" }], "dark": [{ "$ref": "./tokens/theme-dark.json" }] } } }}Resolution Order
Section titled “Resolution Order”resolutionOrder defines the merge order. Sets are merged first, then modifiers overlay. Use $ref to point to sets and modifiers defined above.
{ "resolutionOrder": [ { "$ref": "#/sets/core" }, { "$ref": "#/modifiers/theme" } ]}Permutations
Section titled “Permutations”The resolver computes the cross-product of all modifier contexts (see permutations). With 2 themes and 2 densities, you get 4 permutations:
light+compactlight+comfortabledark+compactdark+comfortable
Each permutation produces a complete token set. Build tools like Dispersa can output one file per permutation (e.g. tokens-light.css, tokens-dark.css).
Avoiding Combinatorial Explosion
Section titled “Avoiding Combinatorial Explosion”Base tokens are shared. Only the differences (theme colors, density spacing) live in modifier contexts. The resolver merges them per permutation instead of requiring separate files for every combination.
Complete Resolver Example
Section titled “Complete Resolver Example”{ "version": "2025.10", "sets": { "core": { "sources": [ { "$ref": "./tokens/colors.json" }, { "$ref": "./tokens/spacing.json" } ] } }, "modifiers": { "theme": { "default": "light", "contexts": { "light": [{ "$ref": "./tokens/theme-light.json" }], "dark": [{ "$ref": "./tokens/theme-dark.json" }] } } }, "resolutionOrder": [ { "$ref": "#/sets/core" }, { "$ref": "#/modifiers/theme" } ]}This resolver loads core tokens, then overlays light or dark theme tokens based on the selected context.