> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kansolabs.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Options

> Every option the plugin takes, with its default.

Every target takes the same options, typed as `UnpluginStyleDictionaryOptions` and exported from every entry point.

```ts theme={null}
import type { UnpluginStyleDictionaryOptions } from '@kanso-labs/unplugin-style-dictionary/vite'
```

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.

**cache** `boolean` (default: true)

Whether a configuration whose output is already up to date may skip its compile. See [Caching](/style-dictionary/caching.md).

**config** `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](/style-dictionary/configuration.md).

**errorOverlay** `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`.

**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](/style-dictionary/logging-and-errors.md#when-a-failure-stops-the-build).

**logLevel** `'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](/style-dictionary/logging-and-errors.md).

**onBuildEnd** `(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](/style-dictionary/build-hooks.md).

**onBuildError** `(error: unknown) =\> Promise\<void\> | void`

Called when a build fails, whatever `failOnError` says.

**onBuildStart** `() =\> Promise\<void\> | void`

Called before a build begins, once per build, watch rebuilds included.

**platforms** `string[] | \{ build?: string[]; watch?: string[] \}`

Which platforms to build, by the names the configuration defines. Unset builds every platform. See [Building only some platforms](/style-dictionary/platforms.md).

**report** `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.

**root** `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](/style-dictionary/paths.md).

**silent** `boolean` (default: false)

An alias for `logLevel: 'silent'`, which wins if both are set. A failed compile is still reported.

**watch** `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](/style-dictionary/watching.md#watching-more-files).

## 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.

**command** `'build' | 'serve'`

`'serve'` under Vite's dev server, from Vite's `config.command`. Every other target builds.

**mode** `string`

Vite's `config.mode`, or whatever `--mode` named, or webpack's `mode`. Rollup and Rolldown follow `command`: `'development'` serving, `'production'` building.

**watch** `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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.