Skip to content
SOVEREIGN

Configuration

Place sovereign.config.json at the repository root. The Guard reads it on every run. It is optional: without it, scan runs in zero-config mode. A key the Guard does not recognise is reported as a warning and ignored.

sovereign.config.json
{
  "themes": { "directory": "./themes", "pattern": "*.resolved.json" },
  "tokenPrefix": "--semantic-",
  "tenants": { "light": ["src/light/**"], "dark": ["src/dark/**"] },
  "contrast": { "minRatio": 4.5, "tenants": { "dark": 7 } },
  "require": ["contrast"],
  "ignore": ["legacy/**"],
  "skipGenerated": ["**/*.min.css"]
}
  • themes says where the resolved theme files are. Paths resolve from the config file.
  • tokenPrefix is the prefix of the generated custom property names. It defaults to --semantic-.
  • tenants maps path globs, relative to the repository root, to theme ids.
  • contrast.minRatio is the text contrast floor. It defaults to 4.5, and a tenant can have its own.
  • require lists gates that must have something to test. If one has nothing, the run exits 2.
  • ignore excludes paths from the scan, relative to the scan target. Stories, tests, build output and vendored code are ignored by default. Set defaultIgnores to false to drop those defaults.
  • skipGenerated lists globs for minified or generated files to leave out. Nothing is skipped unless a glob names it.
  • require accepts contrast, budget, tokens and markup. With a config file the default is contrast and tokens.
  • fix.styles.target is the existing stylesheet that scan --fix-inline-styles adds rules to. fix.styles.classPrefix sets the prefix of the classes it writes.
  • thirdParties.ownOrigins lists hosts to treat as your own. thirdParties.register gives a one-line reason for each other host. thirdParties.rules turns on the third-party rules you want. They are used with scan --evidence --third-parties.
  • contrast.variableStylesheets lists stylesheets that are read only for the custom properties they define, such as a generated token file. contrast.controls adds class names to treat as form controls.
  • focus.focusable adds class names to treat as able to take keyboard focus.