Migrating to Facet
Adopt Facet incrementally by replacing token output first, then moving authoring surfaces.
Facet is designed to enter an existing codebase through generated tokens before a full authoring
migration. The source explicitly calls out a compatibility tokens.css emitter for existing CSS
variable conventions.
Incremental path
- Import or author the token graph.
- Configure the resolver to match current theme selectors such as
:rootand.dark. - Emit
tokens.cssin a compatible variable format. - Keep existing consumers on CSS variables while moving components to utilities,
fx(), or recipes over time. - Add
facet checkin CI to gate contrast, mode contracts, and off-system authoring.
Import legacy tokens
The CLI includes a one-way import helper:
facet import legacy.tokens.json
The existing docs and source describe this as converting legacy or Tokens Studio-like values to the Facet graph:
valueandtypebecome$valueand$type- bare hex colors become the object color model
- dimension strings such as
16pxor0.5rembecome{ value, unit } - aliases such as
{color.brand.500}are preserved
Preserve existing selectors
The resolver selector map lets a migration keep current mode hooks:
{
"theme": {
"values": ["light", "dark"],
"default": "light",
"selector": { "light": ":root", "dark": ".dark" }
}
}
When the emitted tokens.css matches the existing variable convention, downstream styles can keep
reading variables while the source of truth moves to Facet.
Move authored styles gradually
Facet can scan markup utilities:
<article class="bg-surface fg-ink radius-panel p-inset-lg shadow-card">
...
</article>
It can also scan static fx() calls in source files:
const cardStyle = fx({ bg: "surface", fg: "ink", radius: "panel", p: "inset.lg" });
Because both lower to the same atoms, teams can mix old markup, utilities, and fx() while a
migration is underway.
Interop exports
Facet remains the source of truth for these generated outputs:
facet export tokens/app.resolver.json --out tokens.dtcg.json
facet tailwind tokens/app.resolver.json --out tailwind.css
facet styledict tokens/app.resolver.json --out tokens.styledict.json
These are documented as one-directional exporters. Do not plan a round trip from Tailwind, Style Dictionary, or Figma back into the Facet graph unless a future source explicitly adds that workflow.