mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-01 21:39:28 -06:00
## Summary This PR completes Phase 2 of the SCSS migration to prepare for Dart Sass 3.0.0 compatibility. This phase focused on converting the complex conditional theme system from deprecated `@import` statements to modern `@use` statements. ## What Changed ### 🎯 Major Achievements - **Eliminated 43+ SCSS deprecation warnings** (down from 45+ to only 2 remaining) - **96% reduction** in deprecation warnings - **Converted all SCSS-to-SCSS imports** from `@import` to `@use` - **Modernized all color functions**: `lighten()`, `darken()`, `adjust-color()`, `transparentize()`, `opacify()` → `color.scale()` and `color.adjust()` - **Implemented CSS custom properties** for theme variable sharing - **Fixed theme isolation** - themes now properly scope their styles ### 🔧 Technical Changes - Added `@use` statements for all theme files at top of `explorer.scss` - Wrapped all theme file contents in `html[data-theme='...']` selectors - Added CSS custom properties (`:root { --lighter: #{$lighter}; }`) for theme variables - Scoped custom golden-layout themes within their respective theme selectors - Removed all conditional `@import` statements for SCSS files ### 📁 Files Modified - `static/styles/explorer.scss` - Added theme `@use` statements, removed conditional imports - `static/styles/themes/pink-theme.scss` - Scoped all styles, added CSS custom properties - `static/styles/themes/one-dark-theme.scss` - Scoped all styles, added CSS custom properties - `static/styles/themes/dark-theme.scss` - Scoped all styles - `static/styles/themes/default-theme.scss` - Scoped all styles - `static/styles/themes/custom-golden-layout-themes/pink.scss` - Scoped to pink theme - `static/styles/themes/custom-golden-layout-themes/one-dark.scss` - Scoped to one-dark theme ## Remaining Issues (Phase 3) ⚠️ **2 deprecation warnings remain** - these will eventually break in Dart Sass 3.0.0: ``` Line 1161: @import '~golden-layout/src/css/goldenlayout-light-theme'; Line 1168: @import '~golden-layout/src/css/goldenlayout-dark-theme'; ``` These are external CSS imports from the golden-layout library that cannot be converted to `@use` because: 1. They're CSS files, not SCSS files 2. They use webpack's `~` syntax for node_modules resolution 3. They're conditionally imported based on theme **Phase 3 will need to address these** by either: - Converting to regular CSS `@import` at top level - Using webpack's CSS importing mechanism - Including CSS files directly in HTML - Finding alternative golden-layout integration approach ## Testing - ✅ Webpack build succeeds with only 2 expected warnings - ✅ Visual testing confirms themes work correctly - ✅ Pink theme now shows proper light golden-layout theme (was showing dark before) - ✅ All theme styles properly isolated - no global style conflicts - ✅ CSS custom properties working for theme variables ## Build Output Current warnings (only external CSS imports remain): ``` WARNING: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0 Line 1161: @import '~golden-layout/src/css/goldenlayout-light-theme'; Line 1168: @import '~golden-layout/src/css/goldenlayout-dark-theme'; ``` All other webpack warnings are performance-related (bundle sizes), not SCSS deprecations. ## Migration Progress - ✅ **Phase 1**: Basic color function and simple import conversions (merged) - ✅ **Phase 2**: Complex conditional theme system conversion (this PR) - 🔄 **Phase 3**: External CSS import resolution (future work) This PR makes Compiler Explorer's SCSS mostly compatible with Dart Sass 3.0.0, with only 2 external library imports remaining to be addressed. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>