Skip to content

Base Styles: Reapply wpds-var Sass helper#79470

Draft
mirka wants to merge 1 commit into
trunkfrom
revert/reapply-wpds-sass-fallbacks
Draft

Base Styles: Reapply wpds-var Sass helper#79470
mirka wants to merge 1 commit into
trunkfrom
revert/reapply-wpds-sass-fallbacks

Conversation

@mirka

@mirka mirka commented Jun 24, 2026

Copy link
Copy Markdown
Member

What?

Reapplies the wpds-var() Sass helper work that was reverted in #79429.

Why?

The helper is still needed so @wordpress/base-styles Sass can compile design token references with fallback values in build environments that do not run the token fallback PostCSS plugin.

This PR restores the original generated fallback map, Sass helper, base-styles mixin support, package dependency, tests, and docs. A follow-up stacked PR adjusts the public Sass entrypoint so consumers do not need to import from generated src/prebuilt internals.

How?

Reverts the revert commit 3031bb0fa1398ee07778cfb36065a6e3950db5fa on top of current trunk.

Testing Instructions

  1. Run npm run test:unit packages/theme/bin/terrazzo-plugin-ds-token-fallbacks/test.
  2. Confirm the tests pass.

@github-actions

Copy link
Copy Markdown

Size Change: +10.5 kB (+0.14%)

Total Size: 7.52 MB

📦 View Changed
Filename Size Change
build/styles/base-styles/admin-schemes-rtl.css 1.79 kB +105 B (+6.22%) 🔍
build/styles/base-styles/admin-schemes.css 1.79 kB +105 B (+6.22%) 🔍
build/styles/block-directory/style-rtl.css 2.09 kB +100 B (+5.02%) 🔍
build/styles/block-directory/style.css 2.09 kB +100 B (+5.02%) 🔍
build/styles/block-editor/content-rtl.css 5.66 kB +100 B (+1.8%)
build/styles/block-editor/content.css 5.66 kB +100 B (+1.8%)
build/styles/block-editor/style-rtl.css 18.7 kB +109 B (+0.59%)
build/styles/block-editor/style.css 18.8 kB +109 B (+0.58%)
build/styles/block-library/audio/style-rtl.css 1.04 kB +100 B (+10.58%) ⚠️
build/styles/block-library/audio/style.css 1.04 kB +100 B (+10.58%) ⚠️
build/styles/block-library/audio/theme-rtl.css 1.07 kB +101 B (+10.44%) ⚠️
build/styles/block-library/audio/theme.css 1.07 kB +101 B (+10.44%) ⚠️
build/styles/block-library/columns/style-rtl.css 1.4 kB +100 B (+7.71%) 🔍
build/styles/block-library/columns/style.css 1.4 kB +100 B (+7.71%) 🔍
build/styles/block-library/common-rtl.css 2.67 kB +96 B (+3.73%)
build/styles/block-library/common.css 2.69 kB +97 B (+3.75%)
build/styles/block-library/editor-rtl.css 12.6 kB +106 B (+0.85%)
build/styles/block-library/editor.css 12.6 kB +105 B (+0.84%)
build/styles/block-library/embed/style-rtl.css 1.39 kB +101 B (+7.84%) 🔍
build/styles/block-library/embed/style.css 1.39 kB +101 B (+7.84%) 🔍
build/styles/block-library/embed/theme-rtl.css 1.07 kB +101 B (+10.44%) ⚠️
build/styles/block-library/embed/theme.css 1.07 kB +101 B (+10.44%) ⚠️
build/styles/block-library/freeform/editor-rtl.css 1.22 kB +101 B (+9.05%) 🔍
build/styles/block-library/freeform/editor.css 1.22 kB +101 B (+9.05%) 🔍
build/styles/block-library/gallery/editor-rtl.css 1.56 kB +102 B (+6.98%) 🔍
build/styles/block-library/gallery/editor.css 1.56 kB +103 B (+7.05%) 🔍
build/styles/block-library/gallery/style-rtl.css 2.96 kB +106 B (+3.72%)
build/styles/block-library/gallery/style.css 2.96 kB +106 B (+3.72%)
build/styles/block-library/gallery/theme-rtl.css 1.04 kB +101 B (+10.73%) ⚠️
build/styles/block-library/gallery/theme.css 1.04 kB +101 B (+10.73%) ⚠️
build/styles/block-library/html/editor-rtl.css 1.39 kB +99 B (+7.66%) 🔍
build/styles/block-library/html/editor.css 1.4 kB +99 B (+7.6%) 🔍
build/styles/block-library/image/editor-rtl.css 1.74 kB +99 B (+6.02%) 🔍
build/styles/block-library/image/editor.css 1.74 kB +99 B (+6.03%) 🔍
build/styles/block-library/image/style-rtl.css 3.01 kB +98 B (+3.36%)
build/styles/block-library/image/style.css 3.02 kB +99 B (+3.39%)
build/styles/block-library/image/theme-rtl.css 1.07 kB +100 B (+10.3%) ⚠️
build/styles/block-library/image/theme.css 1.07 kB +100 B (+10.3%) ⚠️
build/styles/block-library/latest-posts/style-rtl.css 1.46 kB +102 B (+7.52%) 🔍
build/styles/block-library/latest-posts/style.css 1.47 kB +100 B (+7.29%) 🔍
build/styles/block-library/navigation-submenu/editor-rtl.css 1.22 kB +99 B (+8.84%) 🔍
build/styles/block-library/navigation-submenu/editor.css 1.22 kB +102 B (+9.11%) 🔍
build/styles/block-library/navigation/editor-rtl.css 3.38 kB +103 B (+3.14%)
build/styles/block-library/navigation/editor.css 3.39 kB +103 B (+3.13%)
build/styles/block-library/navigation/style-rtl.css 3.69 kB +101 B (+2.81%)
build/styles/block-library/navigation/style.css 3.69 kB +104 B (+2.9%)
build/styles/block-library/page-list/editor-rtl.css 1.28 kB +99 B (+8.39%) 🔍
build/styles/block-library/page-list/editor.css 1.28 kB +99 B (+8.39%) 🔍
build/styles/block-library/post-template/style-rtl.css 1.37 kB +102 B (+8.02%) 🔍
build/styles/block-library/post-template/style.css 1.37 kB +102 B (+8.02%) 🔍
build/styles/block-library/query/editor-rtl.css 1.4 kB +100 B (+7.7%) 🔍
build/styles/block-library/query/editor.css 1.4 kB +100 B (+7.7%) 🔍
build/styles/block-library/rss/style-rtl.css 1.21 kB +101 B (+9.13%) 🔍
build/styles/block-library/rss/style.css 1.22 kB +102 B (+9.12%) 🔍
build/styles/block-library/shortcode/editor-rtl.css 1.2 kB +97 B (+8.81%) 🔍
build/styles/block-library/shortcode/editor.css 1.2 kB +97 B (+8.81%) 🔍
build/styles/block-library/style-rtl.css 21.7 kB +100 B (+0.46%)
build/styles/block-library/style.css 21.9 kB +101 B (+0.46%)
build/styles/block-library/table/editor-rtl.css 1.35 kB +100 B (+7.99%) 🔍
build/styles/block-library/table/editor.css 1.35 kB +100 B (+7.99%) 🔍
build/styles/block-library/table/theme-rtl.css 1.08 kB +100 B (+10.15%) ⚠️
build/styles/block-library/table/theme.css 1.08 kB +100 B (+10.15%) ⚠️
build/styles/block-library/template-part/editor-rtl.css 1.32 kB +97 B (+7.92%) 🔍
build/styles/block-library/template-part/editor.css 1.32 kB +97 B (+7.92%) 🔍
build/styles/block-library/theme-rtl.css 1.69 kB +98 B (+6.15%) 🔍
build/styles/block-library/theme.css 1.69 kB +98 B (+6.14%) 🔍
build/styles/block-library/video/style-rtl.css 1.13 kB +100 B (+9.72%) ⚠️
build/styles/block-library/video/style.css 1.13 kB +100 B (+9.72%) ⚠️
build/styles/block-library/video/theme-rtl.css 1.07 kB +101 B (+10.44%) ⚠️
build/styles/block-library/video/theme.css 1.07 kB +101 B (+10.44%) ⚠️
build/styles/commands/style-rtl.css 2.17 kB +101 B (+4.87%) 🔍
build/styles/commands/style.css 2.17 kB +100 B (+4.83%) 🔍
build/styles/components/style-rtl.css 18.2 kB +101 B (+0.56%)
build/styles/components/style.css 18.3 kB +100 B (+0.55%)
build/styles/customize-widgets/style-rtl.css 2.46 kB +101 B (+4.29%)
build/styles/customize-widgets/style.css 2.45 kB +101 B (+4.3%)
build/styles/edit-post/classic-rtl.css 1.39 kB +101 B (+7.85%) 🔍
build/styles/edit-post/classic.css 1.41 kB +101 B (+7.7%) 🔍
build/styles/edit-post/style-rtl.css 3.92 kB +94 B (+2.46%)
build/styles/edit-post/style.css 3.93 kB +96 B (+2.51%)
build/styles/edit-site/style-rtl.css 22.3 kB +220 B (+1%)
build/styles/edit-site/style.css 22.3 kB +217 B (+0.98%)
build/styles/edit-widgets/style-rtl.css 4.96 kB +104 B (+2.14%)
build/styles/edit-widgets/style.css 4.96 kB +102 B (+2.1%)
build/styles/editor/style-rtl.css 31.1 kB +308 B (+1%)
build/styles/editor/style.css 31.1 kB +311 B (+1.01%)
build/styles/list-reusable-blocks/style-rtl.css 1.13 kB +99 B (+9.65%) ⚠️
build/styles/list-reusable-blocks/style.css 1.13 kB +98 B (+9.54%) ⚠️
build/styles/media-utils/style-rtl.css 2.25 kB +103 B (+4.8%) 🔍
build/styles/media-utils/style.css 2.25 kB +103 B (+4.8%) 🔍
build/styles/patterns/style-rtl.css 1.54 kB +101 B (+7.03%) 🔍
build/styles/patterns/style.css 1.54 kB +99 B (+6.89%) 🔍
build/styles/preferences/style-rtl.css 1.36 kB +99 B (+7.83%) 🔍
build/styles/preferences/style.css 1.36 kB +100 B (+7.92%) 🔍
build/styles/reusable-blocks/style-rtl.css 1.21 kB +99 B (+8.94%) 🔍
build/styles/reusable-blocks/style.css 1.21 kB +99 B (+8.94%) 🔍
build/styles/widgets/style-rtl.css 2.15 kB +97 B (+4.72%) 🔍
build/styles/widgets/style.css 2.15 kB +96 B (+4.67%) 🔍

compressed-size-action

@github-actions

Copy link
Copy Markdown

Flaky tests detected in 4a500d6.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/28080744102
📝 Reported issues:

@mirka mirka self-assigned this Jun 24, 2026

@aduth aduth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thought is if we could do some sort of pre-processing on base-styles so that the fallback values are injected into what's published as the _mixins.scss. That would allow us to reuse some of what already exists for wp-build instead of adding another. But I can see the value (as documented) in having something Sass specific for this.

Comment on lines +184 to +190
/**
* Standard focus rings for the WordPress Design System.

* Apply `outset-ring__focus` inside the relevant pseudo-class at the call site,
* e.g. `&:focus { @include outset-ring__focus(); }`.
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some extra newlines in here. (I'd at least expect the * if the newline was intentional within the comment)

Suggested change
/**
* Standard focus rings for the WordPress Design System.
* Apply `outset-ring__focus` inside the relevant pseudo-class at the call site,
* e.g. `&:focus { @include outset-ring__focus(); }`.
*/
/**
* Standard focus rings for the WordPress Design System.
* Apply `outset-ring__focus` inside the relevant pseudo-class at the call site,
* e.g. `&:focus { @include outset-ring__focus(); }`.
*/

Comment thread packages/theme/README.md
The `@wordpress/theme/design-token-fallbacks` export provides a generated `wpds-var()` function that wraps token references with the same fallback map used by the build plugins — for example, `wpds.wpds-var('--wpds-color-fg-content-neutral')` compiles to `var(--wpds-color-fg-content-neutral, #1e1e1e)`.

```scss
@use '@wordpress/theme/design-token-fallbacks' as wpds;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if we'd find any value in generalizing this now to contain future utilities later, named accordingly (either as index or something like "design-tokens")? Like if they're already importing "as wpds", is this just the "wpds sass utilities" ? Maybe granularity is still useful there in a pick-and-choose sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Base styles /packages/base-styles [Package] Theme /packages/theme

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants