design.md icon indicating copy to clipboard operation
design.md copied to clipboard

Feature: add CSS custom properties export (--format css-vars) for native CSS consumers

Open dl-alexandre opened this issue 7 months ago • 3 comments

Add a CLI export target for CSS variables, for example:

npx @google/design.md export --format css-vars DESIGN.md > design.tokens.css

Expected output

Generate a :root block with stable, semantic custom properties derived from tokens, e.g.:

:root {
  --color-primary: #1A1C1E;
  --color-secondary: #6C7278;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --rounded-sm: 4px;
  --rounded-md: 8px;
}

Optionally support:

  • --selector :root
  • --prefix ds
  • dark-theme/media-query variants later if the spec grows there

Why this helps

  • makes DESIGN.md more useful outside Tailwind ecosystems
  • gives coding agents a direct artifact they can apply in native CSS codebases
  • improves adoption for frameworks that want CSS variables as the implementation boundary
  • complements DTCG export without requiring downstream token tooling

dl-alexandre avatar Apr 21 '26 22:04 dl-alexandre

Current roadmap linkage refresh: issue #15 remains a direct follow-up under #29 (Token interoperability roadmap). The current canonical sequence is #30 (workspace/build reliability) first, then export-surface delivery such as #15 and #19, with #28 after those and #27 as a cross-cutting spec dependency where needed.

seonghobae avatar Apr 23 '26 06:04 seonghobae

Reviewing this one soon!

davideast avatar May 01 '26 23:05 davideast

Implemented in https://github.com/google-labs-code/design.md/pull/109 - a new --format css-vars export emits a :root { ... } block of CSS custom properties from the token set, with an optional --prefix. Scope matches the issue: core format plus prefix, dark-theme/media-query variants deferred.

mvanhorn avatar Jun 20 '26 19:06 mvanhorn