Skip to content

Commit f0c163b

Browse files
authored
Use @forward instead of @use for proper customization (#41762)
* Use `@forward` instead of `@use` for proper customization * linty linterson * woof
1 parent 956de4b commit f0c163b

File tree

4 files changed

+84
-32
lines changed

4 files changed

+84
-32
lines changed

scss/bootstrap-utilities.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
// @forward "variables";
77

88
// Layout & components
9-
@use "root" as *;
9+
@forward "root";
1010

1111
// Helpers
1212
@forward "helpers";
1313

1414
// Utilities
15-
@use "utilities" as *;
16-
@use "utilities/api";
15+
@forward "utilities";
16+
@forward "utilities/api";

scss/bootstrap.scss

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
@use "banner";
1+
@forward "banner";
22

33
// scss-docs-start import-stack
44
// Global CSS variables, layer definitions, and configuration
5-
@use "root";
5+
@forward "root";
66

77
// Subdir imports
8-
@use "content";
9-
@use "layout";
10-
@use "forms";
11-
@use "buttons";
8+
@forward "content";
9+
@forward "layout";
10+
@forward "forms";
11+
@forward "buttons";
1212

1313
// Components
14-
@use "accordion";
15-
@use "alert";
16-
@use "badge";
17-
@use "breadcrumb";
18-
@use "card";
19-
@use "carousel";
20-
@use "dropdown";
21-
@use "list-group";
22-
@use "modal";
23-
@use "nav";
24-
@use "navbar";
25-
@use "offcanvas";
26-
@use "pagination";
27-
@use "placeholders";
28-
@use "popover";
29-
@use "progress";
30-
@use "spinners";
31-
@use "toasts";
32-
@use "tooltip";
33-
@use "transitions";
14+
@forward "accordion";
15+
@forward "alert";
16+
@forward "badge";
17+
@forward "breadcrumb";
18+
@forward "card";
19+
@forward "carousel";
20+
@forward "dropdown";
21+
@forward "list-group";
22+
@forward "modal";
23+
@forward "nav";
24+
@forward "navbar";
25+
@forward "offcanvas";
26+
@forward "pagination";
27+
@forward "placeholders";
28+
@forward "popover";
29+
@forward "progress";
30+
@forward "spinners";
31+
@forward "toasts";
32+
@forward "tooltip";
33+
@forward "transitions";
3434

3535
// Helpers
36-
@use "helpers";
36+
@forward "helpers";
3737

3838
// Utilities
39-
@use "utilities/api";
39+
@forward "utilities/api";
4040
// scss-docs-end import-stack

scss/tests/jasmine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
spec_dir: 'scss',
99
// Make Jasmine look for `.test.scss` files
1010
// spec_files: ['**/*.{test,spec}.scss'],
11-
spec_files: ['**/_utilities.test.scss'],
11+
spec_files: ['**/_utilities.test.scss', '**/modules/_configuration.test.scss'],
1212
// Compile them into JS scripts running `sass-true`
1313
requires: [path.join(__dirname, 'sass-true/register')],
1414
// Ensure we use `require` so that the require.extensions works
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Test @use with configuration syntax using a single module instance
2+
@use "../../alert" as * with (
3+
$alert-margin-bottom: 3rem,
4+
$alert-link-font-weight: 800
5+
);
6+
@use "../../variables" as *;
7+
8+
$true-terminal-output: false;
9+
10+
@include describe("Bootstrap module configuration") {
11+
@include describe("@use with configuration syntax") {
12+
@include it("should allow configuring alert variables with @use ... with") {
13+
@include assert() {
14+
@include output() {
15+
.test {
16+
margin-bottom: $alert-margin-bottom;
17+
font-weight: $alert-link-font-weight;
18+
}
19+
}
20+
21+
@include expect() {
22+
.test {
23+
margin-bottom: 3rem;
24+
font-weight: 800;
25+
}
26+
}
27+
}
28+
}
29+
30+
@include it("should maintain other alert variables with default values") {
31+
@include assert() {
32+
@include output() {
33+
.test {
34+
padding-y: $alert-padding-y;
35+
padding-x: $alert-padding-x;
36+
// stylelint-disable-next-line property-disallowed-list
37+
border-radius: $alert-border-radius;
38+
}
39+
}
40+
41+
@include expect() {
42+
.test {
43+
padding-y: 1rem;
44+
padding-x: 1rem;
45+
// stylelint-disable-next-line property-disallowed-list
46+
border-radius: var(--bs-border-radius);
47+
}
48+
}
49+
}
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)