Skip to content

Revert Sass @import replacement - preserve CSS cascade order - #796

Closed
Dan Marshall (danmarshall) with Copilot wants to merge 3 commits into
mainfrom
copilot/replace-sass-imports
Closed

Dan Marshall (danmarshall) with Copilot wants to merge 3 commits into
mainfrom
copilot/replace-sass-imports

Conversation

Copilot AI commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

After analysis, reverted the migration from @import to @use to preserve CSS cascade order and styling behavior.

Analysis

The original attempt to replace @import with @use would have changed the CSS output order, potentially breaking styling due to specificity rules. Files like app.scss and sanddance-app.scss intentionally placed imports at the bottom or middle to control CSS cascade.

Decision

Keep @import for all CSS imports because:

  1. CSS Order Preservation: Moving imports to the top (required by @use) changes the CSS cascade and specificity
  2. Sass Import (A place for python bower components) (@import) Deprecation Scope: The deprecation warning primarily applies to Sass partials, not CSS file imports
  3. Technical Constraint: Sass requires all @use statements before @import statements, making it impossible to maintain the original order when mixing both
  4. Import Types: All imports in question are for compiled CSS files (.css in dist/ folders), not Sass partials

Current State

All files remain using @import as originally designed, preserving the intended CSS cascade order and maintaining the working behavior. The deprecation warnings for CSS file imports are acceptable and expected.

Note: docs/ folder unchanged - uses Jekyll with Ruby Sass 3.x which doesn't support @use/Forward (@forward).

Original prompt

Replace sass Import (A place for python bower components) (@import)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace Sass @import with alternative syntax Replace deprecated Sass @import with @use Jan 23, 2026
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
@use "../../../../packages/sanddance-explorer/dist/css/sanddance-explorer";

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.

Copilot this is now at the top, where the Import (A place for python bower components) (@import) you replaced was at the bottom. Doesn't order matter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're absolutely right - order matters for CSS cascade. I've reverted all the Will Hall (@use) changes in commit 47ccd7f.

The issue is that Sass requires all Will Hall (@use) statements before any Import (A place for python bower components) (@import) statements, which would force the imported CSS to appear at a different position in the output, potentially breaking specificity rules.

Since Import (A place for python bower components) (@import) deprecation only applies to Sass partials (not CSS files), and these files are importing compiled CSS, keeping Import (A place for python bower components) (@import) is the correct approach to preserve the intended CSS order.

Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
Copilot AI changed the title Replace deprecated Sass @import with @use Revert Sass @import replacement - preserve CSS cascade order Jan 23, 2026
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