Replace node-sass with dart-sass#12156
Conversation
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. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Twenty Nineteen theme’s front-end build pipeline to replace node-sass (LibSass) with sass (Dart Sass), and adjusts theme Sass/PostCSS to keep the generated CSS output stable (fonts/selectors/colors) under the new compiler.
Changes:
- Replace
node-sasswithsassand update build scripts accordingly. - Refactor the
font-family()Sass mixin away from@extend-based generation for non‑latin font fallbacks. - Add a PostCSS step to enforce one selector per line, and hard-code a few color outputs previously produced by deprecated
lighten()/darken().
Reviewed changes
Copilot reviewed 6 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/wp-content/themes/twentynineteen/style-editor.css | Regenerated editor stylesheet output from Dart Sass + updated mixins/formatting. |
| src/wp-content/themes/twentynineteen/sass/variables-site/_colors.scss | Replace deprecated lighten()/darken() outputs with literal hex values. |
| src/wp-content/themes/twentynineteen/sass/site/primary/_comments.scss | Replace deprecated lighten() output with a literal hex value. |
| src/wp-content/themes/twentynineteen/sass/mixins/_mixins-master.scss | Refactor font-family() mixin to inline non‑latin fallbacks instead of @extend. |
| src/wp-content/themes/twentynineteen/print.css | Regenerated/normalized selector formatting in print CSS output. |
| src/wp-content/themes/twentynineteen/postcss.config.js | Add a custom PostCSS plugin to reformat selector lists. |
| src/wp-content/themes/twentynineteen/package.json | Swap dependency to sass and update build scripts to use the Sass CLI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @mixin font-family( $font_family: $font__body ) { | ||
| font-family: $font_family; | ||
| @extend %non-latin-fonts; | ||
| } | ||
|
|
||
| /* Build our non-latin font styles */ | ||
| %non-latin-fonts { | ||
| @each $lang, $font__fallback in $font__fallbacks { | ||
| &:lang(#{$lang}) { |
This replaces
node-sasswithsass(Dart Sass).Looking into the issues raised on the Trac ticket, here is some output from Claude around each one.
This appears to be caused by the redundancy elimination part of Dart Sass related to the use of
@extend.Full output from Claude: Output ignores five of the selectors when it creates font overrides for each non-latin language
This one seems to be caused by
lighten()/darken(), which have been deprecated. I've gone and hard coded the intended hex values to address this for now.Full output from Claude: Why are hexidecimal colors output as `rgb()` and slightly different?
These come from the lighten()/darken() calls the deprecation warnings flagged in _comments.scss:240 and elsewhere. The
math:
Browsers accept fractional rgb() (CSS Color L4), so the rendered color is rgb(0, 80.5, 119) — half a step off the prior
rgb(0, 81, 119). Imperceptible visually, but technically not byte-identical and slightly off from what the designer
presumably intended (#5177).
The right fix is the same as resolving the deprecation: replace lighten()/darken() calls with the intended literal hex
(best — that's what the designer originally meant), or wrap with color.adjust() which is the modern API. As a stopgap
you can wrap with round() to coerce channels back to integers.