Getting started
Project configuration
dsf.hcl declares where the package is and which targets to generate, so one command regenerates every output.
dsf.hcl
Put dsf.hcl at the root of your project. dsfc generate reads it and produces every target.
my-project/
├── dsf.hcl
├── design-system/
│ ├── design-system.dsf
│ ├── tokens.dsf
│ └── button.dsf
├── generated/ # written by dsfc generate
└── public/design-system/ # written by dsfc generate
version = 1
package = "design-system" # directory holding design-system.dsf, relative to dsf.hcl
target "swiftui" {
output = "generated/swiftui"
options = { prefix = "DS" }
accept = ["context.text_scale"] # a known approximation, accepted knowingly
}
target "angular" {
output = "generated/angular"
options = { prefix = "ds" }
}
target "dtcg" {
output = "generated/tokens"
options = { materialize = true }
}
target "docs" {
output = "public/design-system"
options = { title = "Acme Design System", logo = "assets/logo.svg", base_url = "/design-system/" }
palette = { background = "color.surface", text = "color.on-surface", accent = "color.action" }
}
Attributes
| Attribute | Meaning |
|---|---|
version |
Version of the project file format. Must be 1. |
package |
Directory (or manifest file) of the package, relative to dsf.hcl. Defaults to the directory of dsf.hcl. |
target "<name>" |
One block per target, each at most once: swiftui, angular, dtcg or docs. |
output |
Required. Directory the target writes to: relative to dsf.hcl (.. allowed) or absolute. |
options |
Generator options (strings, numbers, booleans). Listed on each target page: SwiftUI, Angular, DTCG JSON, Documentation site. Every target rejects an option it does not know: never silently ignored. |
palette |
docs only: the tokens that theme the generated documentation. |
accept |
Approximations of the target the project acknowledges: capability IDs, or families as the registry spells them (context.text_scale, context.<axis>). Their DSF-X004 warning becomes an info that says so (it no longer fails --deny-warnings), and dsf-build.json marks the entry "accepted": true. Only what the target can report: SwiftUI context.text_scale and a11y.value.range, Angular a11y.actions; anything else is DSF-P007. |
A logo path is relative to dsf.hcl. Any invalid project file (wrong version, unknown
attribute or target, missing output, a target declared twice, an accept entry the target
cannot report) is DSF-P007, located in dsf.hcl. accept is read by dsfc generate and
dsfc check --config only: a target named with --target, without a project file, accepts
nothing.
Commands
dsfc generate # every target, reading ./dsf.hcl
dsfc generate --target docs # only the named target(s)
dsfc generate --config path/to/dsf.hcl
- The package is checked once and every target is produced in memory. If any error is
reported — in the package,
dsf.hclor a generator — nothing is written. - Each output directory gets a
dsf-build.jsonlisting its files. On the next run, files listed there that are no longer produced are removed; other files are never touched.
The Quick start has a complete run.
dsfc build --target <name> --output <dir> does the same for one target without a project
file. dsfc check --config dsf.hcl checks the package and every target the file declares,
with its options, and writes nothing. The other commands (test, fmt, ir, tokens) take a
package path. See the CLI reference.