All jobs

Fix "Using / for division outside of calc() is deprecated" in Sass

Yes. An agent runs the Sass migrator across your partials, proves the compiled CSS is byte-identical, flags what breaks for LibSass users and opens a PR.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent compiles the project with Dart Sass first, to see the warnings as a user of the stylesheets sees them. In a library like sierra-library/sierra the entry point is src/index.scss, which pulls in its partials with 23 @import lines. The default output shows five slash-div warnings and a note that repetitive ones were omitted; with --verbose there are 32. They come from six partials: utils/_layout.scss, components/_forms.scss, components/_loading-spinner.scss, components/_tag.scss, grid/_grid-framework.scss and grid/_grid.scss. It saves the compiled CSS from this run as the baseline.

It also notices that the repository would never show these warnings by itself. package.json lists node-sass 4 as the compiler, and the build scripts call node-sass --include-path scss src/index.scss. The warning is a Dart Sass message. It reaches people who install the package and compile lib/index.scss with their own toolchain, as the README tells them to. That shapes the fix: the stylesheets are the product, and whatever the agent writes has to compile for the people who consume them.

The rewrite itself is done by the official migrator. Run as sass-migrator division src/index.scss it reports that there is nothing to migrate, because the divisions are in imported files; it needs --migrate-deps to follow them. With that flag it edits the six partials. Halving becomes multiplication, so $w-gutter / 2 turns into $w-gutter * 0.5. Where the divisor is a variable or negative, as in $size / $columns and $grid-gutter-width / -2 in grid/_grid.scss, it writes math.div(...) and adds @use "sass:math"; to the top of that one file.

Then the agent compiles again and compares. The CSS has to be byte-identical to the baseline, and the slash-div warnings have to be gone. It reports the warnings that remain, which are other deprecations: the @import rule, global built-in functions, the if() function and a colour function. And it deals with the compiler. @use is module syntax that node-sass does not understand, so the repository's own build has to move to the sass package, and its --include-path flag, which Dart Sass rejects, becomes --load-path.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Users of our Sass get: Deprecation Warning [slash-div]: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0. Fix it. Read package.json and the build scripts and say which Sass compiler this repository uses and with which flags. Compile the entry stylesheet with the current Dart Sass, with --verbose, and report the count of warnings per deprecation id and the files the slash-div ones come from. Save the compiled CSS as a baseline. Run sass-migrator division on the entry point with --migrate-deps (run it without the flag first and report what it says). Review every edit the migrator made: list which divisions became multiplication and which became math.div, and check any slash it left alone is a real CSS separator (font shorthand, grid-area, aspect-ratio) and not a division it missed. Compile again and compare the CSS to the baseline byte for byte; any difference is a failure to explain, not to accept. Report the remaining warnings by id without fixing them. If the edits use @use or math.div, say what that requires of the compiler: update this repository's own build to a compiler that supports it, changing only the flags that need to change, and state clearly in the pull request that consumers compiling with LibSass or node-sass can no longer build these files, with the minimum Dart Sass version needed. Run the full build script and confirm its outputs still appear. Open a pull request.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

A pull request with two commits. The first moves the build from node-sass to sass in package.json, with the flag change in build:prod and build:dev and nothing else. The second is the migrator's output across six partials, about thirty changed lines. The description gives the warning counts by id before and after, and the result of the byte comparison of the compiled CSS. A division fix that changes output is a bug, so that comparison is the main thing a reviewer looks for.

The description also states the compatibility cost in plain terms. grid/_grid.scss now begins with @use "sass:math", so anyone who compiles the library with LibSass gets a syntax error where they used to get a stylesheet. For a published library that is a breaking change, and the agent recommends a major version and a changelog line. It points out the alternative it did not take: the multiplication rewrites compile everywhere, and only the five math.div call sites force the newer compiler.

What is left is listed, not fixed. The remaining deprecations each have their own migrator and their own risks, with @import the largest, and mixing them into this change would make the byte-identical check harder to reason about.

Run it on every GitHub issue labelled sass-deprecation

For a library, the report usually arrives as an issue from someone whose build log filled with warnings. An automation in the repository's Project with a github trigger on issues.labeled, filtered to a label such as sass-deprecation, starts a run when a maintainer adds the label. The issue is placed after the saved prompt as event text, so the reporter's compiler version and warning text are in front of the agent, while the prompt stays the only instruction. The trigger fires only for work by an owner, member or collaborator, which means the label has to be applied by one of them.

A team that owns many themes or design-system packages can use a weekly schedule trigger instead, one automation per Project, with a prompt that compiles first and ends with a one-line note when there are no slash-div warnings. Each Dart Sass release can add deprecations, and a weekly compile with --verbose finds them before users do.

The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.

Why run it on Rush?

The migrator does the typing. The work is everything around it: compiling before and after, comparing output byte for byte, finding out that the first migrator invocation silently did nothing, and noticing that the repository's own compiler cannot build the result. Each of those is a command with output worth keeping, and the run's transcript keeps them, so the claim of identical CSS is backed by the comparison that showed it.

It also needs a compiler the repository does not have installed. The run has its own sandbox, installs current sass and sass-migrator there without touching anyone's global packages, and works on a branch. When a company has twenty stylesheet packages with the same warning, each gets its own run and its own pull request, and the reviewer reads twenty short descriptions with the same three numbers in each.

Frequently asked questions

Why does the migrator say there is nothing to migrate?

It only edits the file you name unless told otherwise. When that file is an index of @import lines, the divisions are all in the imported partials. Passing --migrate-deps makes it follow imports and rewrite those files too. The agent runs it both ways and reports the difference.

Why did some divisions become * 0.5 and others math.div?

The migrator turns division by a plain number into multiplication by its reciprocal when that is exact, which needs no new syntax. For a variable or negative divisor it uses math.div from the built-in sass:math module. Both compile to the same CSS as before, which the byte comparison confirms.

Can I keep supporting node-sass users?

Only if no file uses @use or math.div. The multiplication rewrites are safe for every compiler, but an expression like $size / $columns has no multiplication form, so it either stays as a deprecated slash or moves to math.div. The agent states which call sites force the choice so you can decide before merging.

Will it also fix the @import warnings?

Not in this pull request. Moving from @import to @use changes how variables and mixins are shared between files and is a larger migration with its own tool. The agent counts those warnings and lists them so the follow-up work is visible.

More Sass jobs

More jobs like this: Upgrade dependencies weekly

Keep reading