Skip to content

Replace deprecated sass if statements with new syntax (Second Attempt)#1192

Open
brentswisher wants to merge 2 commits intodevelopfrom
chore/remove-deprecated-sass-statements-second-attempt
Open

Replace deprecated sass if statements with new syntax (Second Attempt)#1192
brentswisher wants to merge 2 commits intodevelopfrom
chore/remove-deprecated-sass-statements-second-attempt

Conversation

@brentswisher
Copy link
Contributor

@brentswisher brentswisher commented Feb 6, 2026

This change: (check at least one)

  • Adds a new feature
  • Fixes a bug
  • Improves maintainability
  • Improves documentation
  • Is a release activity

Is this a breaking change? (check one)

  • Yes
  • No

Is the: (complete all)

  • Title of this pull request clear, concise, and indicative of the issue number it addresses, if any?
  • Test suite(s) passing?
  • Code coverage maximal?
  • Changeset added?

What does this change address?
Because we are using an older deprecated version of the sass if syntax, we are currently getting warnings like this when building the styles:

Deprecation Warning [if-function]: The Sass if() syntax is deprecated in favor of the modern CSS syntax.

While the old version is still functional, these build warnings also propagate down to consuming apps, and are quite noisy and annoying.

How does this change work?
Uses the sass migrator tool to update the if statements to the new syntax, fixing the warnings.

This is a followup of #1184 which had to be reverted due to unexpected style impacts.

The issue in #1184 was that prettier does not understand how to correctly format multi-line if statements in the new sass syntax yet. So it was formatting this:

  $side-width: if(
    sass($sidenav): 17; else: 0
  );

into this, with an extra comma:

  $side-width: if(
    sass($sidenav): 17; else: 0,
  );

When it then compiled to CSS, the CSS blocks that rely on the functions/mixins would compile as empty blocks, breaking the styles.

While It looks like this was reported and fixed for single line if statement here: prettier/prettier#18465, it is still an issue for multi-line statements. I will file a bug with them next week, but in the mean time I added prettier-ignore comments around the new usages.

@brentswisher brentswisher self-assigned this Feb 6, 2026
@changeset-bot
Copy link

changeset-bot bot commented Feb 6, 2026

🦋 Changeset detected

Latest commit: 4b5942b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@ithaka/pharos Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

size-limit report 📦

Path Size
packages/pharos/lib/index.js 1.04 MB (0%)

@brentswisher brentswisher force-pushed the chore/remove-deprecated-sass-statements-second-attempt branch from df9a7d6 to 9a4e6d0 Compare February 6, 2026 21:40
The new sass if syntax does not play well with prettier right now, the
trailingComma: 'es5' setting specifically causes it to add a comma in the
middle of multi-line sass if statements, breaking the functionality
@brentswisher brentswisher marked this pull request as ready for review February 6, 2026 22:31
@brentswisher brentswisher requested a review from a team as a code owner February 6, 2026 22:31
@brentswisher brentswisher requested review from daneah, mtorres3, phosphotungstic and sirrah-tam and removed request for a team February 6, 2026 22:31
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.

2 participants