You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(tokens): wire style-dictionary — design-system.dtcg.json is now SoT (#4)
Closes the manual-mirror gap between `design-system.dtcg.json` (the
file designers edit in Penpot) and the Sass partials Odoo compiles.
After this PR the JSON is the single source of truth; SCSS regenerates
on demand.
┌─────────────────────────────────────────┐
│ design-system.dtcg.json ← edit this │
└──────────────────┬──────────────────────┘
│ pnpm run tokens
┌─────────────┴───────────────┐
▼ ▼
_tokens.generated.scss dist/brand_variables.scss
(loaded by manifest) (drop into ledoweb_branding)
## What's in the PR
- `package.json` — pins `style-dictionary@^5.4.0` (the v5 line reads
DTCG `$value`/`$type` natively, including shadow object → string).
- `style-dictionary.config.js` — two platforms:
- `scss-ods-tokens` writes `odoo_design_system/static/src/scss/_tokens.generated.scss`
(bucket palette + extension palette + `:root` CSS custom
properties for size / shadow / motion).
- `scss-brand` writes `dist/brand_variables.scss` (overrides for
`$o-enterprise-color` / `$o-community-color` / `$o-brand-*` plus
the portal chrome variables; consumer copies the file into their
branding module).
- `_tokens.scss` (renamed in role): now just hand-written hash
helpers + selector-generating mixins. The palette data + :root vars
moved to the generated file. `_tokens.scss` references the
generated maps by name; manifest order makes them in-scope before
the mixins execute.
- Manifest assets reordered so `_tokens.generated.scss` loads first
in both `web.assets_backend` and `web.assets_frontend`.
- `scripts/check-tokens-in-sync.mjs` — the CI gate. Runs the
generator and `git diff --exit-code` against the committed files;
prints the drift and exits 1 if anyone forgot to re-run after
editing the JSON.
- `pnpm run tokens` / `pnpm run tokens:watch` / `pnpm run tokens:check`
scripts in `package.json`.
- `_tokens.scss` mixins now read `--ods-card-shadow-hover`,
`--ods-card-lift-duration`, and `--ods-card-lift-easing` from CSS
vars instead of hard-coding values — they were already in the JSON
but unused.
- `readme/USAGE.md` documents the pipeline with the diagram +
workflow steps. `readme/ROADMAP.md` strikes through the wired
follow-up.
## Verification
- `pnpm run tokens` → both files regenerate, no diff against committed
- `pnpm run tokens:check` → exits 0 (✓ both files match)
- libsass compiles the concatenated bundle to 15 023 bytes of CSS
(no warnings, no errors)
- Anchor extension keys (`image`, `media`, etc.) are filtered out of
the runtime Sass map — they exist in the JSON for designer
reference but no markup carries `data-ext="image"`.
## Not in scope
The brand-logo follow-up (tokenize `#D97706` → `currentColor`) ships
as a separate PR on ledoent/erp's `ledoweb_branding` module, since
the logo file lives there.
"description": "Build pipeline: regenerates Odoo-side SCSS partials from design-system.dtcg.json (the single source of truth for designers via Penpot/Figma).",
0 commit comments