Skip to content

refactor(build): modernize scss pipeline (@use + sass/lightningcss)#843

Merged
lcottercertinia merged 2 commits into
certinia:mainfrom
lukecotter:refactor-sass-modernize
Jul 9, 2026
Merged

refactor(build): modernize scss pipeline (@use + sass/lightningcss)#843
lcottercertinia merged 2 commits into
certinia:mainfrom
lukecotter:refactor-sass-modernize

Conversation

@lukecotter

Copy link
Copy Markdown
Collaborator

📝 PR Overview

Modernizes the webview's SCSS toolchain: migrates off the deprecated Sass @import rule to the module system, and replaces the unmaintained rollup-plugin-postcss (which calls the deprecated legacy sass.render API) with a small custom plugin built on Sass's modern API + Lightning CSS. Removes all Sass deprecation warnings, drops three dependencies, and speeds up the dev build ~35%.

🛠️ Changes made

  • SCSS → module system: DataGrid.scss now loads tabulator's SCSS via @use 'sass:meta' + meta.load-css(...) with a $with config map (kept inside @layer tabulator to preserve the cascade demotion); DatabaseView.scss uses @use. Bumps sass to ^1.101.0. Compiled CSS is byte-identical to before.
  • New build plugin scripts/rollup-plugin-css.mjs (wired into both rollup.config.mjs and rolldown.config.ts): compiles SCSS with Sass's modern compileString API (no legacy-js-api deprecation) and minifies with lightningcss. Each style import both export defaults the compiled CSS string (for Lit unsafeCSS shadow styles) and injects a <style> into document.head — the head injection is required because tabulator appends tooltips/edit-list popups to document.body (light DOM), which the shadow-root copy can't reach.
  • Removes rollup-plugin-postcss, postcss-url, and postcss.
  • Faster builds: pnpm build:dev:fast ~1.03s → ~0.68s warm (~35%); no more legacy Sass API deprecation output.

🧩 Type of change (check all applicable)

  • 🐛 Bug fix - something not working as expected
  • ✨ New feature – adds new functionality
  • ♻️ Refactor - internal changes with no user impact
  • ⚡ Performance Improvement
  • 📝 Documentation - README or documentation site changes
  • 🔧 Chore - dev tooling, CI, config
  • 💥 Breaking change

📷 Screenshots / gifs / video [optional]

No visual change — compiled CSS is semantically identical (only cosmetic minifier differences: color notation, selector ordering, shorthand merges). Grid theming, hover/selection, header/footer transparency, min-max filter inputs, progress bars, and body-appended tooltips/edit-list popups all render as before.

🔗 Related Issues

✅ Tests added?

  • 👍 yes
  • 🙅 no, not needed
  • 🙋 no, I need help

Build-tooling refactor with no runtime behaviour change; the existing suite (962 tests) passes, and CSS parity was verified by diffing the compiled @layer tabulator output against main.

📚 Docs updated?

  • 🔖 README.md
  • 🔖 CHANGELOG.md
  • 📖 help site
  • 🙅 not needed

Anything else we need to know? [optional]

sass-embedded was evaluated and rejected: it's ~2–3× slower per-compile for this small workload (IPC overhead) and slower on cold builds (which CI uses), for a native-binary dependency — plain sass (modern API) is simpler and faster here.

"Replace deprecated Sass @import with @use / meta.load-css; bump sass to ^1.101.0.

DataGrid.scss loads tabulator via meta.load-css with a \$with config map inside
@layer; DatabaseView.scss @import->@use. legacy-js-api warning silenced until
the pipeline is replaced. Compiled CSS byte-identical to previous output.
…edded + lightningcss plugin"

rollup-plugin-postcss uses the deprecated legacy sass.render API and is unmaintained.
Replace it in both rollup and rolldown builds with a small custom plugin
(scripts/rollup-plugin-css.mjs) built on sass-embedded (modern async API) and
lightningcss (minify) — the primitives Vite uses.

Each style import both default-exports the compiled CSS string (Lit unsafeCSS
shadow styles) and injects a <style> into document.head — the head injection is
required because tabulator appends tooltips/edit-list popups to document.body.

Drops postcss, postcss-url, sass, and  rollup-plugin-postcss.
Compiled CSS is semantically identical (only cosmetic minifier differences).
@lcottercertinia lcottercertinia merged commit 54df159 into certinia:main Jul 9, 2026
7 checks passed
@lukecotter lukecotter deleted the refactor-sass-modernize branch July 9, 2026 15:00
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.

2 participants