Skip to content

Migrate from sassc to modern CSS compilation - #527

Open
cycomachead wants to merge 1 commit into
mainfrom
cycomachead/211-upgrade-css-compilation/1
Open

Migrate from sassc to modern CSS compilation#527
cycomachead wants to merge 1 commit into
mainfrom
cycomachead/211-upgrade-css-compilation/1

Conversation

@cycomachead

Copy link
Copy Markdown
Contributor

General Info

Changes

Replaces the deprecated sassc-rails (LibSass) gem with dartsass-sprockets, resolving the Gemfile TODO. Dart Sass is the only maintained Sass implementation; everything else about the pipeline (Sprockets, stylesheet_link_tag, manifest.js, gem-provided SCSS) is unchanged.

Key changes:

  • Gemfile — swap sassc-rails for dartsass-sprockets ~> 3.2. (sassc itself remains as a transitive dependency of font-awesome-sass and sassc-embedded, but no longer compiles anything.)
  • config/initializers/dartsass.rb (new) — silences Bootstrap 5.3's @import deprecation warnings (quiet_deps for gem stylesheets, silence_deprecations: ['import'] for our own). Can be removed when Bootstrap 6 ships.
  • application.scss — adds @use "sass:color" and updates mix() calls to color.mix() (the modern Sass module API). Adds %%25 to $escaped-characters so Dart Sass's fractional color serialization doesn't drop bare % into SVG data URIs.
  • DataTables stylesheets — renamed from .css to _*.scss partials and re-imported without the .css extension. Previously, @import "….css" was passed through as a plain CSS @import url(...) rather than being inlined — meaning both DataTables stylesheets 404'd in production since they were never precompiled. Inlining fixes this. The unquote("rgb(var(--x))") LibSass workarounds are also removed, since Dart Sass handles rgb(var(…)) natively.

Testing

  • rspec: 584 examples, 0 failures
  • rspec --tag a11y: 40 examples, 0 failures (all pages × light/dark × role, axe-audited)
  • Pixel-diffed all 40 a11y screenshots before vs. after: 19 byte-identical; all remaining diffs are test-data noise (timestamps, not styling)
  • cucumber: same 5 pre-existing failures, no new failures
  • Production boot verified: single application.css with DataTables rules inlined, no stray @import remaining

Visual Changes

No styling changes — only test-data noise (timestamps) differs between old and new screenshots.

Documentation

No documentation changes required.

Checklist

  • Name of branch corresponds to story

Superconductor Ticket Implementation | App Preview | Guided Review

- Replace deprecated `sassc-rails` (LibSass) with `dartsass-sprockets`.
- Update `application.scss` to use modern Sass module syntax (`@use "sass:color"`).
- Rename DataTables CSS files to SCSS partials to ensure they are inlined during compilation, fixing a production 404 bug.
- Add `config/initializers/dartsass.rb` to silence Bootstrap `@import` deprecation warnings.
- Fix SVG data URI encoding by adding `%` to `$escaped-characters` to handle Dart Sass color serialization.
- Remove LibSass-specific `unquote()` workarounds for CSS variables.

Co-authored-by: Claude Code <noreply@anthropic.com>
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