Repository navigation
refactor(sass): replace the deprecated if() and require Sass 1.97.1 - #670
Merged
Merged
Conversation
- Every conditional in sass/ and the themes spec is an @if/@else block or an `or`/`and` expression, so Sass 1.95+ prints no if-function warning and older Sass still compiles. The compiled CSS does not change. - _optional-shades, _default-variant and bem--not-selector replace the repeated nested if() calls. - The bem separators are `!default`, so `@use ... with (...)` can set them. - sass-embedded is 1.107.1 in theming, mcp and preview, and tests/deprecations.test.ts fails the suite on any deprecation warning. Closes #641.
simeonoff
marked this pull request as ready for review
November 13, 2026 10:42
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the Sass conditional migration and minimum compiler version update.
No open issues 🎉
What changed in this PR
Addresses #641 by migrating Ignite UI Theming away from deprecated Sass if() syntax and establishing Dart Sass 1.97.1 as the minimum supported compiler.
Changes:
- Replaces legacy conditionals across Sass modules and tests, and makes BEM separators configurable with
!default. - Updates compiler dependencies and adds minimum-version CI coverage and a deprecation-warning test.
- Documents compiler requirements and conditional-writing guidance for contributors and MCP consumers.
| File | Description |
|---|---|
| README.md | Documents the Sass minimum and links contribution guidance. |
| packages/theming/tests/deprecations.test.ts | Adds a check for Sass deprecation warnings. |
| packages/theming/tests/_themes.spec.scss | Migrates test conditionals and updates an assertion. |
| packages/theming/sass/utils/_string.scss | Replaces numeric-parser conditionals with control flow. |
| packages/theming/sass/utils/_meta.scss | Updates conditional syntax in a documentation example. |
| packages/theming/sass/utils/_css.scss | Modernizes shorthand-expansion conditional syntax. |
| packages/theming/sass/typography/_mixins.scss | Migrates font normalization, validation, and scope conditionals. |
| packages/theming/sass/typography/_functions.scss | Uses a logical fallback for typography overrides. |
| packages/theming/sass/themes/components/progress/_linear-theme.scss | Rewrites schema selection with an @if block. |
| packages/theming/sass/themes/components/button/_fab-button-theme.scss | Rewrites foreground fallback branches. |
| packages/theming/sass/themes/_mixins.scss | Migrates token, line-clamp, and spacing conditionals. |
| packages/theming/sass/themes/_functions.scss | Modernizes property fallback and spacing conditionals. |
| packages/theming/sass/json/generators.scss | Computes curve values without legacy if(). |
| packages/theming/sass/elevations/_mixins.scss | Modernizes elevation scope selection. |
| packages/theming/sass/color/_mixins.scss | Migrates shade checks and scope selection. |
| packages/theming/sass/color/_generator.scss | Rewrites palette-generation conditionals. |
| packages/theming/sass/color/_functions.scss | Refactors optional shades, variants, and color fallbacks. |
| packages/theming/sass/color/_contrast.scss | Replaces the luminance conditional with an early return. |
| packages/theming/sass/bem/_index.scss | Migrates conditionals and enables separator configuration. |
| packages/theming/package.json | Updates Sass requirements and the Sass test dependency. |
| packages/preview/package.json | Updates the preview’s embedded Sass compiler. |
| packages/mcp/src/tools/handlers/platform.ts | Adds the Sass minimum to installation guidance. |
| packages/mcp/src/tools/descriptions.ts | States compiler requirements for Sass output. |
| packages/mcp/src/knowledge/docs/setup/platform.md | Documents compiler requirements and upgrade guidance. |
| packages/mcp/README.md | Clarifies local and server-side Sass requirements. |
| packages/mcp/package.json | Raises the embedded Sass dependency range. |
| package-lock.json | Records compiler and test dependency updates. |
| CONTRIBUTING.md | Adds development, compatibility, and conditional-writing guidance. |
| .github/workflows/node.js.yml | Adds minimum-Sass checks and read-only repository permissions. |
Review effort: Balanced
simeonoff
approved these changes
Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #641.
Sass 1.95 deprecates the legacy
if()function. Every call is replaced. Most become early-return@ifblocks,@if/@elsechains, oror/andexpressions. Short one-line assignments use the CSS-styleif(sass(…): …; else: …).Also in this PR:
if()evaluates only the branch it picks.sassis an optional peer dependency (>=1.97.1), andsass-embeddedstays a dependency, now^1.97.1instead of~1.107.1.sass-minimumCI job builds and tests with the lowestsassandsass-embeddedversions in that range.$bem--sep-*variables are now!default, so@use … with (…)can configure them.CONTRIBUTING.mdcovers when to use each kind of conditional and the supported Sass versions. The README, the MCP README and the MCP's setup guidance state the minimum version.The compiled output doesn't change. The theming build, all 135 Ignite UI for Angular stylesheets and all 776 Ignite UI for Web Components stylesheets are byte-for-byte the same as master.
Projects that compile with Sass older than 1.97.1 get a compile error. npm projects with an older top-level
sassget anERESOLVEerror at install. Angular 22 ships Sass 1.99 or newer.