Repository navigation
Compile SCSS with sass-embedded - #3765
Crabcyborg wants to merge 1 commit into
Conversation
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>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
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 matchespackage.json. Onlysass-embedded+ its darwin binary are installed (no plainsass, as expected with that flag).npm run build→ finishes with no warnings, andgit statusis clean afterwards: the committedcss/andjs/outputs are exactly what the new compiler produces.webpack --config-name cssthree times: 1.6 s cold, then 0.6 s twice, no deprecation output (sosilenceDeprecations: [ 'import' ]is taking effect and sass-loader is usingsass-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
sassin the repo (scripts, workflows, docs):webpack.config.jsis the only place, and it goes through sass-loader. - Every workflow that installs JS dependencies uses
--omit=optional(thephpunit.ymlnpm ciis WordPress core's, not this repo's), sosass-embeddedstaying inoptionalDependencieskeeps it out of CI likesasswas. - 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/watcherand its platform builds). That matches the PR description. - Plain
npm ciwithout--legacy-peer-depsfails with ERESOLVE oneslintpeer 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).
Compiles Lite's SCSS with
sass-embeddedinstead of the pure JavaScriptsasspackage, so the CSS build runs about twice as fast.Stacked on #3764. It targets that branch and should merge after it.
sass1.54.0 is replaced bysass-embedded1.108.2 inoptionalDependencies, so CI still skips it. sass-loader pickssass-embeddedautomatically when it is installed.webpack.config.jssets sass-loader'sapi: 'modern-compiler', which keeps one compiler process alive for every SCSS file instead of starting one per file.@import(30 in this build).silenceDeprecations: [ 'import' ]hides it. Moving the SCSS from@importto@usebefore Dart Sass 3 is separate work.npmstill installssass1.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 whennpm_config_build_from_source=true.Output
Every built CSS and JS file is byte-identical except
frm-border-radius-component.cssand theformidable-web-components.jsbundle 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 setdisplay, 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:The full
npm run buildgains less, because the JS config runs in parallel and takes longer.Testing
npm ci --legacy-peer-deps && npm run buildfinishes with no warnings.git statusshows only the two files above changed.Steps 1 and 2 were run locally. Step 3 has not been run yet.
🤖 Generated with Claude Code