Revert Sass @import replacement - preserve CSS cascade order - #796
Dan Marshall (danmarshall) with Copilot wants to merge 3 commits into
Conversation
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
| @@ -1,5 +1,7 @@ | |||
| // Copyright (c) Microsoft Corporation. All rights reserved. | |||
| // Licensed under the MIT license. | |||
| @use "../../../../packages/sanddance-explorer/dist/css/sanddance-explorer"; | |||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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>
After analysis, reverted the migration from
@importto@useto preserve CSS cascade order and styling behavior.Analysis
The original attempt to replace
@importwith@usewould have changed the CSS output order, potentially breaking styling due to specificity rules. Files likeapp.scssandsanddance-app.scssintentionally placed imports at the bottom or middle to control CSS cascade.Decision
Keep
@importfor all CSS imports because:@use) changes the CSS cascade and specificity@usestatements before@importstatements, making it impossible to maintain the original order when mixing both.cssindist/folders), not Sass partialsCurrent State
All files remain using
@importas 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
💡 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.