Skip to content

refactor(sass): replace the deprecated if() and require Sass 1.97.1 - #670

Merged
simeonoff merged 7 commits into
masterfrom
mpopov/fix-641-sass-if-function
Nov 13, 2026
Merged

simeonoff merged 7 commits into
masterfrom
mpopov/fix-641-sass-if-function

Conversation

@desig9stein

@desig9stein desig9stein commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #641.

Sass 1.95 deprecates the legacy if() function. Every call is replaced. Most become early-return @if blocks, @if/@else chains, or or/and expressions. Short one-line assignments use the CSS-style if(sass(…): …; else: …).

Also in this PR:

  • Sass 1.97.1 or later is required. It's the first release where the new if() evaluates only the branch it picks. sass is an optional peer dependency (>=1.97.1), and sass-embedded stays a dependency, now ^1.97.1 instead of ~1.107.1.
  • A new sass-minimum CI job builds and tests with the lowest sass and sass-embedded versions in that range.
  • The $bem--sep-* variables are now !default, so @use … with (…) can configure them.
  • A deprecation test fails on any Sass deprecation warning while compiling the e2e theme.
  • A new CONTRIBUTING.md covers 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 sass get an ERESOLVE error at install. Angular 22 ships Sass 1.99 or newer.

- 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.
@desig9stein desig9stein self-assigned this Nov 10, 2026
@simeonoff simeonoff changed the title refactor(sass): replace the deprecated if() function with @if and or refactor(sass): replace the deprecated if() and require Sass 1.97.1 Nov 13, 2026
@simeonoff
simeonoff marked this pull request as ready for review November 13, 2026 10:42
Comment thread .github/workflows/node.js.yml Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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
simeonoff added this pull request to the merge queue Nov 13, 2026
Merged via the queue into master with commit 9d53473 Nov 13, 2026
6 checks passed
@simeonoff
simeonoff deleted the mpopov/fix-641-sass-if-function branch November 13, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate off the deprecated Sass if() function

4 participants