Skip to main content
Every target takes the same options, typed as UnpluginStyleDictionaryOptions and exported from every entry point.
A value of the wrong shape for failOnError, logLevel or platforms throws a TypeError when the plugin is created, rather than quietly falling back to a default.
boolean
default:"true"
Whether a configuration whose output is already up to date may skip its compile. See Caching.
string | string[] | Config | Config[] | false | (context) => Config | Config[] | Promise<Config | Config[]>
The Style Dictionary configuration or configurations to build: a path, paths, an object, objects, or a function handed a StyleDictionaryConfigContext. Left out, the root is searched for sd.config.json, config.json, sd.config.js and sd.config.mjs. false turns that search off. See Configuration.
boolean
default:"true"
Whether a failed rebuild is pushed to Vite’s error overlay, and dismissed by the next one that succeeds. Does nothing on the other targets or under vite build. Independent of failOnError.
'build' | 'serve' | boolean
default:"'build'"
Whether a failed compile throws rather than only being reported. 'build' throws on the first compile and reports a failed watch rebuild; 'serve' is the reverse; true throws on both and false on neither. A failure is reported either way. See Logging and errors.
'silent' | 'warn' | 'info' | 'verbose'
How much the plugin and Style Dictionary say while building. Unset prints the plugin’s own lines and leaves the configuration’s log.verbosity alone. There is no 'error', since a failure is reported at every level. See Logging and errors.
(files: string[], durationMs: number) => Promise<void> | void
Called once a build has finished, with every file it declares that is on disk. See Build hooks.
(error: unknown) => Promise<void> | void
Called when a build fails, whatever failOnError says.
() => Promise<void> | void
Called before a build begins, once per build, watch rebuilds included.
string[] | { build?: string[]; watch?: string[] }
Which platforms to build, by the names the configuration defines. Unset builds every platform. See Building only some platforms.
boolean
default:"true"
Whether the table of generated files with their sizes and gzip sizes is printed. false keeps the progress lines and drops only the table, along with the reading and compressing behind it.
string
The directory a relative config path is looked up in and a relative watch entry resolves against. Defaults to the host’s root: Vite’s root, webpack’s or rspack’s context, or the working directory for rollup and rolldown. It does not move the paths inside a configuration. See Path resolution.
boolean
default:"false"
An alias for logLevel: 'silent', which wins if both are set. A failed compile is still reported.
string | string[]
More files or glob patterns to watch, on top of a config given as a path and every file the configurations’ source and include match. A change to one re-imports a configuration module. See Watching.

StyleDictionaryConfigContext

What the function form of config is handed. Only Vite reports all three; where a host does not say, the value is derived rather than guessed.
'build' | 'serve'
'serve' under Vite’s dev server, from Vite’s config.command. Every other target builds.
string
Vite’s config.mode, or whatever --mode named, or webpack’s mode. Rollup and Rolldown follow command: 'development' serving, 'production' building.
boolean
true under Vite’s dev server, vite build --watch, rollup --watch, rolldown.watch() and webpack --watch. Read from the plugin context’s meta.watchMode, or from compiler.watchMode on webpack.