Skip to content

Build Options

Reference for all available configuration options in the build.yaml file.

targets:
$default:
builders:
design_builder|design_builder:
enabled: true
options:
# Options go here

Type: string
Default: lib/schema/theme-spec.schema.json

Path to the JSON schema file that validates your token files.

options:
spec_path: "assets/schema.json"

Type: string
Default: lib/**.tokens.json

Glob pattern to locate your token JSON files.

options:
input_glob: "lib/**/*.tokens.json"

Type: string
Default: design_tokens

Directory where generated files will be placed, relative to the lib folder.

options:
output_path: "generated/themes"

Type: string
Default: app_theme

Name of the generated Dart file (without the .dart extension).

options:
output_file_name: "my_app_theme"

Type: string
Default: AppTheme

Name of the main generated class.

options:
class_name: "MyAppTheme"
targets:
$default:
builders:
design_builder|design_builder:
enabled: true
options:
spec_path: "lib/schema/theme-spec.schema.json"
input_glob: "lib/**.tokens.json"
output_path: "design_tokens"
output_file_name: "app_theme"
class_name: "AppTheme"

Create different configurations for different environments:

targets:
development:
builders:
design_builder|design_builder:
enabled: true
options:
input_glob: "lib/tokens/dev/*.json"
production:
builders:
design_builder|design_builder:
enabled: true
options:
input_glob: "lib/tokens/prod/*.json"

Run with a specific target:

Terminal window
dart run build_runner build --config=build.yaml -t production