Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Sass compilation breaking change in v5.3 #39380

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1745,3 +1745,5 @@ $kbd-bg: var(--#{$prefix}body-color) !default;
$nested-kbd-font-weight: null !default; // Deprecated in v5.2.0, removing in v6

$pre-color: null !default;

@import "variables-dark"; // TODO: can be removed safely in v6, only here to avoid breaking changes in v5.3
71 changes: 71 additions & 0 deletions scss/tests/mixins/_color-modes-non-breaking.test.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// TODO: this file can be removed safely in v6 when `@import "variables-dark"` will be removed at the end of _variables.scss

// stylelint-disable selector-attribute-quotes

@import "../../functions";
@import "../../variables";
// Voluntarily not importing _variables-dark.scss
@import "../../maps";
@import "../../mixins";

@include describe("global $color-mode-type: data") {
@include it("generates data attribute selectors for dark mode") {
@include assert() {
@include output() {
@include color-mode(dark) {
.element {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
}
@include color-mode(dark, true) {
--custom-color: #{mix($indigo, $blue, 50%)};
}
}
@include expect() {
[data-bs-theme=dark] .element {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
[data-bs-theme=dark] {
--custom-color: #3a3ff8;
}
}
}
}
}

@include describe("global $color-mode-type: media-query") {
@include it("generates media queries for dark mode") {
$color-mode-type: media-query !global;

@include assert() {
@include output() {
@include color-mode(dark) {
.element {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
}
@include color-mode(dark, true) {
--custom-color: #{mix($indigo, $blue, 50%)};
}
}
@include expect() {
@media (prefers-color-scheme: dark) {
.element {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
}
@media (prefers-color-scheme: dark) {
:root {
--custom-color: #3a3ff8;
}
}
}
}

$color-mode-type: data !global;
}
}