Imports & Composition

Compose token files: one file imports another, so a shared brand can feed many architectures — and swapping brands is a one-word edit. Three directives work together: /import, /config, and /override.

Import a File

/import('file') at the top level pulls another file from the same project into the compile. Its values, scales, and modes stay live; bend them with /override. The imported file's token sets keep their identity — exports come out grouped per set (brandA/colors.css), not collapsed into one blob.

// file: brand
brand
    gap = 4

// file: web
/import('brand')
/override(brand.gap = 8)

page
    space = $brand.gap    // 8 — and anything brand built from gap re-derives

The name in quotes is the file's name (extension optional); qualify it with a project name to import from another of your projects: /import('otherProject/brand'). A file can hold several imports; each file is included once, and circular imports are a clear error. In the editor, the imported sets appear as their own sidebar rows — the set holding the /import lines previews only what it defines itself, listing the imported files as feedback rows in its table.

Config Defaults

/config declares defaults that give way the moment a real value provides them — so a template file previews sensibly on its own AND accepts a brand. Same block shapes as /override; relative operators aren't allowed (a config declares, it doesn't adjust).

A fill changes the value only — the declaration keeps its scope and type, so mark knobs :params where they are declared. :params knobs show in the app's table view but never reach exports; tokens built from them export normally.

This template stands alone — the scale derives from the defaults
Config Defaults Defaults that give way when a real value provides them.

Filling the Knobs

Whoever imports the template fills its declared knobs by plain definition — no /override needed. The fill counts at the /config declaration's spot, so the template's own scales derive from the filled values.

// file: brandA
brand
    params
        base = 8

// file: brandA-sizes
/import('sizes')      // the template above
/import('brandA')     // fills brand.params.base → the scale becomes 8, 16, 24, 32

A real definition anywhere — before or after the /config line, same file or another import — replaces the default silently.

The Ladder

Every value sits on one of four rungs. A higher rung wins silently.

config (default)  <  pick (later /config)  <  real / imported value (fill)  <  /override

/override states what a value is — it beats everything, including fills, and everything derived from the value re-derives. See Override. When several /config blocks declare the same path, the last one's value wins — a pick: value only, still config-rank, so a real value anywhere still replaces it silently. A knob can constrain its choices with options([small, medium, large], default = medium) — later values must be one of them, and compositions render such knobs as dropdowns in the table (live until an imported file provides the value, then locked with "set by file").

Multi-brand Pattern

Keep brands as pure value files and templates as config-driven machines. A pairing file marries one of each — and exports like any normal file (CSS, W3C, the CLI, Figma all consume the composed result), with the output organized by the original files and sets.

// file: brandA-web
/import('web')       // the template: config defaults + scales
/import('brandA')    // one brand's values — fills the knobs

// swap 'brandA' for 'brandB' and every output re-derives

Sets that end up empty — a brand consumed entirely as fills, or a set holding only :params knobs — export nothing: no file, no Figma collection.

Composition Files

A composition (comp.tkns) is the pairing file without the code: create one from the project's Create File dialog and stack files by clicking. A files panel lists the imports — add files from this project or your others, drag to reorder, toggle on/off — and the sets panel shows one row per set name with the composed preview.

Order matters exactly like written imports: later files fill the knobs of earlier ones, and two real values for the same token clash loudly. Underneath, a composition is nothing but /import lines the UI writes for you — same compiler, same ladder, same exports.

Conflicts

A token may get its real value from only one file. Two look-alike imports (two brands) are told apart from partial overlaps, and errors inside imported code name the real file, set and line — “In imported file 'brandA', set 'colors', line 3.”

'brandB' and 'brandA' define the same tokens — they look like two versions
of the same file. Import only one of them.

Modes Across Files

Exactly one file declares each mode axis — the brand owns /modes : colorScheme = [light, dark], everyone else references its values. Declaring the same axis twice is a clear error.