mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 09:23:52 -05:00
## Summary **Phase 1 of systematic SCSS modernization** to prepare for Dart Sass 3.0.0 compatibility. This PR eliminates **all deprecated color function warnings** and converts straightforward `@import` statements to modern `@use` syntax. ## What This PR Accomplishes ### ✅ **All Color Function Deprecations Eliminated** (11 instances) - `adjust-color()` → `color.adjust()` (5 instances in `colours.scss`) - `lighten()` → `color.scale($lightness: +%)` (2 instances in `dark-theme.scss`) - `darken()` → `color.scale($lightness: -%)` (4 instances across themes) - Added `@use 'sass:color'` imports to all theme files ### ✅ **@import to @use Conversion** (4 instances) - Internal SCSS-to-SCSS imports converted to modern `@use` syntax - `ansi-dark.scss` imports in theme files - Custom golden layout theme imports - All `@use` statements properly moved to top of files per SCSS requirements ### ✅ **Zero Visual Changes** - All themes render identically to before - Extensive testing across all 4 themes (default, dark, pink, one-dark) - Build process unchanged, functionality preserved ## Technical Approach **5 incremental commits** with systematic validation at each step: 1. Add `@use 'sass:color'` imports (preparation) 2. Convert `colours.scss` color functions 3. Convert `dark-theme.scss` color functions 4. Convert remaining theme color functions 5. Convert internal SCSS `@import` to `@use` Each commit was individually tested for build success and visual consistency. ## What This PR Does NOT Include This is **Phase 1 only** - the following complex migrations are intentionally deferred to **Phase 2**: ### 🔄 **Remaining for Phase 2: Architectural Changes** - **Complex conditional theme system** in `explorer.scss` (lines 1157-1180) - Currently uses HTML attribute-based conditional `@import` statements - Requires architectural redesign (CSS variables or separate entry points) - **CSS imports from node_modules** (FontAwesome, Golden Layout) - Kept as `@import` due to webpack compatibility requirements - **Theme switching mechanism** updates if needed ### 📊 **Migration Progress** - ✅ **Phase 1**: Color functions + simple imports (this PR) - 🔄 **Phase 2**: Conditional theme system redesign - 🔄 **Phase 3**: Final cleanup and optimization ## Deprecation Warning Reduction **Before this PR**: 45+ deprecation warnings **After this PR**: ~15 deprecation warnings (only complex `@import` statements remain) All remaining warnings are the challenging conditional imports that require Phase 2 architectural work. ## Testing - ✅ Build succeeds: `npm run webpack`, `npm run ts-check`, `npm run lint` - ✅ All themes render correctly: default, dark, pink, one-dark - ✅ No visual regressions or functional changes - ✅ Theme switching works identically - ✅ Form controls, scrollbars, and all UI elements maintain proper styling ## Benefits 1. **Future-proofing**: Ready for Dart Sass 3.0.0 color function changes 2. **Maintainability**: Modern, namespaced color functions are clearer 3. **Performance**: Modern `@use` system loads modules once vs `@import` duplication 4. **Incremental approach**: Safe, testable changes with easy rollback if needed ## Follow-up Work This establishes the foundation for **Phase 2**, which will tackle the complex conditional theme system. The architectural decisions for Phase 2 can now be made independently without blocking this foundational modernization. Closes part of #7112 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>