Skip to content

Twenty Nineteen: Replace node-sass with Dart Sass - #13380

Open
manzoorwanijk wants to merge 3 commits into
WordPress:trunkfrom
manzoorwanijk:fix/twentynineteen-dart-sass-trunk
Open

Twenty Nineteen: Replace node-sass with Dart Sass#13380
manzoorwanijk wants to merge 3 commits into
WordPress:trunkfrom
manzoorwanijk:fix/twentynineteen-dart-sass-trunk

Conversation

@manzoorwanijk

@manzoorwanijk manzoorwanijk commented Sep 3, 2026

Copy link
Copy Markdown
Member

Twenty Nineteen is the last default theme still using node-sass, deprecated since 2020. It ships no prebuilt binary for Node.js 22 or later, and its nan-based addon no longer compiles against current V8, so npm install fails on newer runtimes. This blocks #11776, where the build job errors.

This switches to sass and commits the regenerated stylesheets. The build also moves from run-p to run-s, as in Twenty Twenty-One: under run-p, build:rtl races build:style and can regenerate style-rtl.css from a stale style.css.

Non-latin fallbacks

Dart Sass drops contextual @extend selectors it considers redundant, ignoring the specificity they relied on. That cost eight selectors their non-latin font across 31 locales. %non-latin-fonts moves into its own partial imported last, so the fallbacks win on source order instead.

Verification

8907 probes across four fixtures (LTR, RTL, editor, print) in headless Chrome, hashing every computed property and pseudo-element against the node-sass output. Differences reduce to the main navigation button gaining the fallback, and sixth-decimal letter-spacing rounding. npm ci and npm run build reproduce the committed bytes on Node 20 and 24.

This branches from trunk. #13379 stacks the same commits on #11776, where the previously failing build job passes on Node.js 24.

Trac ticket:

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code, Codex
Model(s): Claude Opus 5, GPT-5.4
Used for: Diagnosing the failure, the dependency swap, and differential testing of the output; reviewed and verified by me.

Twenty Nineteen is the last default theme still using `node-sass`, which
has been deprecated since 2020. It ships no prebuilt binary for Node.js
22 or later, and its `nan`-based native addon no longer compiles against
current V8, so `npm install` fails outright on newer runtimes. This
blocks the Node.js 24 upgrade.

Switches to `sass`, as the other default themes already use, and commits
the regenerated stylesheets.

Also runs the build sequentially: under `run-p`, `build:rtl` races
`build:style` and can regenerate `style-rtl.css` from a stale
`style.css`.
Dart Sass drops contextual `@extend` selectors it considers redundant,
without accounting for the specificity those selectors relied on. Eight
fallback rules were subsumed by a less specific selector that a later
equal-specificity rule then won, dropping the non-latin font for all 31
locales on 404 titles, submit/reset/button inputs, cover block headings
and aligned pullquote citations.

Moves `%non-latin-fonts` into its own partial, imported last, so the
fallbacks follow the declarations they override and win on source order
rather than specificity.
…tton.

The raw declaration opted this button out of the non-latin fallbacks that
every other button gets. It now resolves to the fallback anyway, via the
generic `button` selector, but only on an equal-specificity source order
tie. Recording the intent removes that dependency.

Generated CSS is unchanged: Dart Sass folds the new selector into the
existing `button:lang()` groups.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props manzoorwanijk.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant