Twenty Nineteen: Replace node-sass with Dart Sass - #13380
Conversation
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.
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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 itsnan-based addon no longer compiles against current V8, sonpm installfails on newer runtimes. This blocks #11776, where the build job errors.This switches to
sassand commits the regenerated stylesheets. The build also moves fromrun-ptorun-s, as in Twenty Twenty-One: underrun-p,build:rtlracesbuild:styleand can regeneratestyle-rtl.cssfrom a stalestyle.css.Non-latin fallbacks
Dart Sass drops contextual
@extendselectors it considers redundant, ignoring the specificity they relied on. That cost eight selectors their non-latin font across 31 locales.%non-latin-fontsmoves 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-sassoutput. Differences reduce to the main navigation button gaining the fallback, and sixth-decimalletter-spacingrounding.npm ciandnpm run buildreproduce 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.