CLI
Generate token statistics
Inspect token counts and breakdowns in text or HTML format.Generate token statistics
Use dtokens stats to inspect a token system.
dtokens stats tokens.json
Without --out, the command writes a text report to stdout.
Supported sources
Token statistics work with:
- DTCG JSON;
- HRDT YAML;
- DESIGN.md.
Text output
dtokens stats tokens.yaml
This is useful for terminals, scripts, and CI logs.
HTML output
Use --out to generate an HTML report:
dtokens stats tokens.yaml --out ./stats.html
Open it immediately:
dtokens stats tokens.yaml \
--out ./stats.html \
--open
Standard input
cat tokens.yaml | dtokens stats -
You can also omit the source argument:
cat tokens.yaml | dtokens stats
Options
-o, --out <file>— generate an HTML report;--open— open the generated HTML file in the default browser.
Package script example
{
"scripts": {
"tokens:stats": "dtokens stats tokens.json --out ./stats.html"
}
}