Skip to content

Compile SCSS with sass-embedded - #3765

Open
Crabcyborg wants to merge 1 commit into
chore/trim-npm-depsfrom
build/sass-embedded
Open

Crabcyborg wants to merge 1 commit into
chore/trim-npm-depsfrom
build/sass-embedded

Conversation

@Crabcyborg

Copy link
Copy Markdown
Contributor

Compiles Lite's SCSS with sass-embedded instead of the pure JavaScript sass package, so the CSS build runs about twice as fast.

Stacked on #3764. It targets that branch and should merge after it.

  • sass 1.54.0 is replaced by sass-embedded 1.108.2 in optionalDependencies, so CI still skips it. sass-loader picks sass-embedded automatically when it is installed.
  • webpack.config.js sets sass-loader's api: 'modern-compiler', which keeps one compiler process alive for every SCSS file instead of starting one per file.
  • Newer Sass prints a deprecation notice for every @import (30 in this build). silenceDeprecations: [ 'import' ] hides it. Moving the SCSS from @import to @use before Dart Sass 3 is separate work.
  • npm still installs sass 1.108.2, because it is an optional peer dependency of sass-loader, along with its optional @parcel/watcher. That package's install script only builds anything when npm_config_build_from_source=true.

Output

Every built CSS and JS file is byte-identical except frm-border-radius-component.css and the formidable-web-components.js bundle that inlines it. In that file, .frm-border-individual-inputs-wrapper:not(.frm_hidden){display:flex} now comes before the parent's declarations, which is how newer Sass orders declarations written after a nested rule. The parent does not set display, and the :not() rule is more specific anyway, so nothing renders differently.

Timing

CSS config only (webpack --config-name css), three interleaved runs on a busy machine:

wall CPU
sass 1.54 2.5 to 3.8s 4.1 to 4.7s
sass-embedded 1.4 to 2.1s 1.9 to 2.2s

The full npm run build gains less, because the JS config runs in parallel and takes longer.

Testing

  1. npm ci --legacy-peer-deps && npm run build finishes with no warnings.
  2. git status shows only the two files above changed.
  3. Open Styles > Edit style, change the border radius with the corner inputs, and confirm the individual inputs show and hide as before.

Steps 1 and 2 were run locally. Step 3 has not been run yet.

🤖 Generated with Claude Code

Replace sass 1.54 with sass-embedded 1.108.2, which runs the native
Dart Sass compiler, and use sass-loader's modern-compiler API so one
compiler process handles every file. The CSS build takes about half
the time and CPU.

Silence the @import deprecation that newer Sass prints, since the
SCSS has not moved to @use yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 28, 2026

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve. Nothing blocking, no notes. I read the whole PR at 35cc7e0 (one commit on top of #3764's branch: package.json, package-lock.json, webpack.config.js, plus the two rebuilt outputs).

Tests run: no test files in this PR, so nothing for CI to skip. I ran the build instead, in a clean scratch checkout at 35cc7e0:

  • npm ci --legacy-peer-deps → installs cleanly, so the lockfile matches package.json. Only sass-embedded + its darwin binary are installed (no plain sass, as expected with that flag).
  • npm run build → finishes with no warnings, and git status is clean afterwards: the committed css/ and js/ outputs are exactly what the new compiler produces.
  • webpack --config-name css three times: 1.6 s cold, then 0.6 s twice, no deprecation output (so silenceDeprecations: [ 'import' ] is taking effect and sass-loader is using sass-embedded). I did not rebuild on the base branch, so I did not reproduce the author's "about twice as fast" figure.

Output claim checked. The PR changes only two built files. I split the old and new frm-border-radius-component.css into rules and diffed them: the only difference is that .frm-border-individual-inputs-wrapper:not(.frm_hidden){display:flex} now comes before the parent's declarations instead of after (same length, 7953 bytes both). The parent rule sets no display and the :not() selector is more specific, so the cascade result is the same. formidable-web-components.js inlines that CSS.

Other checks:

  • No other consumer of sass in the repo (scripts, workflows, docs): webpack.config.js is the only place, and it goes through sass-loader.
  • Every workflow that installs JS dependencies uses --omit=optional (the phpunit.yml npm ci is WordPress core's, not this repo's), so sass-embedded staying in optionalDependencies keeps it out of CI like sass was.
  • The lockfile adds the platform binaries for sass-embedded (darwin, linux incl. musl, win32) and a handful of small packages (@bufbuild/protobuf, rxjs, varint, sync-child-process, sync-message-port, @parcel/watcher and its platform builds). That matches the PR description.
  • Plain npm ci without --legacy-peer-deps fails with ERESOLVE on eslint peer ranges from @wordpress/eslint-plugin; that is the existing eslint conflict, not sass, and every workflow already passes the flag.

Not exercised: the Styles > Edit style border-radius corner inputs in a browser (step 3 of the PR's own test plan, which the author also had not run), npm run dev watch mode with modern-compiler, and Windows/Linux installs of the platform binaries (only the lock entries were read). CI is all "skipping" on this stacked PR, and the review skills were not run (a build-config change plus two generated files, read in full).

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 28, 2026
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