config option says which Style Dictionary configuration to build. It takes a path, an array of paths, a configuration object, an array of objects, or a function returning any of those. Leave it out and the plugin looks for a file.
Finding a config file
With noconfig, the root is searched for these names, in order:
sd.config.jsonconfig.jsonsd.config.jssd.config.mjs
platforms, source, include or tokens. A candidate that fails that check is skipped rather than adopted, since config.json is a common name for something else entirely. The plugin prints the path it picked and any file it skipped on the way, and reports the skipped files as an error when nothing is adopted.
A configuration problem, such as nothing found or a named file that is missing or will not parse, is said once rather than on every rebuild.
A configuration you name yourself is never second-guessed by the check: it goes straight to Style Dictionary.
File formats
Aconfig path may be .json, .json5, .jsonc, .js, .mjs or .ts. The JSON family is parsed as JSON5, as Style Dictionary does, so comments and trailing commas work in a .json file too.
Several configurations
For several themes or brands, pass an array of paths or objects:A configuration object
A function
config can be a function, which runs before every build, watch rebuilds included. It is handed what the host is doing, so the configuration can depend on it:
'build' | 'serve'
'serve' only under Vite’s dev server. Every other target builds.string
Vite’s
config.mode or webpack’s mode. Rollup and Rolldown have none, so it follows command: 'development' when serving, 'production' when building.boolean
Whether the host will keep rebuilding. Read from the host rather than inferred from
command, because rollup --watch both watches and builds.Custom formats
The function form is where to register a custom format, transform or otherregister* hook before the configuration names it. Re-registering the same name on every rebuild is safe, since Style Dictionary replaces the existing one.
vite.config.ts

