Skip to content

Commit 17a8e9d

Browse files
authored
Update SCSS files to use @use and @forward instead of @import (#4553)
* Ignore SASS warnings from dependencies; switch from @import to @use * Update two unprefixed variables in mixins * Changelog * Document early return for test.scss check
1 parent fb0f06d commit 17a8e9d

File tree

17 files changed

+115
-83
lines changed

17 files changed

+115
-83
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* Dev - Move some testing and compiler node dependencies to devDependencies
2828
* Dev - Minor CSS change to comply with a SASS rule deprecation
2929
* Dev - Remove LPM feature flags
30+
* Dev - Update SCSS to replace @import with @use and @forward
3031

3132
= 9.7.1 - 2025-07-28 =
3233
* Add - Add state mapping for Lithuania in express checkout

client/components/chip/styles.scss

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../styles/abstracts/styles.scss';
1+
@use '../../styles/abstracts/styles';
22

33
.wcstripe-chip {
44
font-size: 12px;
@@ -14,38 +14,38 @@
1414
gap: 2px;
1515

1616
&.wc-stripe-chip-gray {
17-
background: $wp-gray-0;
18-
color: $wp-gray-80;
17+
background: styles.$wp-gray-0;
18+
color: styles.$wp-gray-80;
1919
svg {
20-
fill: $wp-gray-80;
20+
fill: styles.$wp-gray-80;
2121
}
2222
}
2323
&.wc-stripe-chip-green {
24-
background: $wp-green-0;
25-
color: $wp-green-70;
24+
background: styles.$wp-green-0;
25+
color: styles.$wp-green-70;
2626
svg {
27-
fill: $wp-green-70;
27+
fill: styles.$wp-green-70;
2828
}
2929
}
3030
&.wc-stripe-chip-blue {
31-
background: $wp-blue-0;
32-
color: $wp-blue-70;
31+
background: styles.$wp-blue-0;
32+
color: styles.$wp-blue-70;
3333
svg {
34-
fill: $wp-blue-70;
34+
fill: styles.$wp-blue-70;
3535
}
3636
}
3737
&.wc-stripe-chip-red {
38-
background: $wp-red-0;
39-
color: $wp-red-70;
38+
background: styles.$wp-red-0;
39+
color: styles.$wp-red-70;
4040
svg {
41-
fill: $wp-red-70;
41+
fill: styles.$wp-red-70;
4242
}
4343
}
4444
&.wc-stripe-chip-yellow {
45-
background: $wp-yellow-0;
46-
color: $wp-yellow-70;
45+
background: styles.$wp-yellow-0;
46+
color: styles.$wp-yellow-70;
4747
svg {
48-
fill: $wp-yellow-70;
48+
fill: styles.$wp-yellow-70;
4949
}
5050
}
5151
}

client/components/confirmation-modal/style.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../styles/abstracts/styles.scss';
1+
@use '../../styles/abstracts/styles';
22

33
.wcstripe-confirmation-modal {
44
// increasing the specificity of the styles, to ensure it is honored
@@ -11,7 +11,7 @@
1111

1212
// to ensure that the separator extends all the way, even with different versions of Gutenberg
1313
.components-modal__content {
14-
padding: 0 $grid-unit-30 $grid-unit-30;
14+
padding: 0 styles.$grid-unit-30 styles.$grid-unit-30;
1515

1616
@media ( max-width: 599px ) {
1717
display: flex;
@@ -24,7 +24,7 @@
2424
}
2525

2626
.components-modal__header {
27-
padding: 0 $grid-unit-30;
27+
padding: 0 styles.$grid-unit-30;
2828
@media ( max-width: 599px ) {
2929
button {
3030
display: none;
@@ -33,7 +33,7 @@
3333
}
3434

3535
&__separator {
36-
margin: $grid-unit-30 -#{$grid-unit-30};
36+
margin: styles.$grid-unit-30 -#{styles.$grid-unit-30};
3737
}
3838

3939
&__footer {
@@ -42,7 +42,7 @@
4242

4343
> * {
4444
&:not( :first-child ) {
45-
margin-left: $grid-unit-20;
45+
margin-left: styles.$grid-unit-20;
4646
}
4747
}
4848
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
@import '../../styles/abstracts/styles.scss';
1+
@use '../../styles/abstracts/styles';
22

33
.wcstripe-inline-notice {
44
// increasing the specificity of the styles to override the Gutenberg ones
55
&#{&} {
66
margin: 0;
7-
margin-bottom: $grid-unit-20;
7+
margin-bottom: styles.$grid-unit-20;
88
border-left: 0;
99
padding: 12px;
1010

@@ -13,19 +13,19 @@
1313
}
1414
&.is-dismissible {
1515
padding-right: 12px;
16-
gap: $grid-unit-20;
16+
gap: styles.$grid-unit-20;
1717
}
1818
&.is-info {
19-
background: $wp-blue-0;
19+
background: styles.$wp-blue-0;
2020
}
2121
&.is-error {
22-
background: $wp-red-0;
22+
background: styles.$wp-red-0;
2323
}
2424
&.is-warning {
25-
background: $wp-yellow-0;
25+
background: styles.$wp-yellow-0;
2626
}
2727
&.is-success {
28-
background: $wp-green-0;
28+
background: styles.$wp-green-0;
2929
}
3030
}
3131
}

client/components/loadable/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
@import '../../styles/abstracts/styles.scss';
1+
@use '../../styles/abstracts/styles';
22

33
.is-loadable-placeholder {
44
animation: loading-fade 1.6s ease-in-out infinite;
5-
background-color: $light-gray-500;
5+
background-color: styles.$light-gray-500;
66
color: transparent;
77
display: inline-block;
88

client/components/tooltip/style.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../styles/abstracts/styles.scss';
1+
@use '../../styles/abstracts/styles';
22

33
.wcstripe-tooltip {
44
&__content-wrapper {
@@ -30,8 +30,8 @@
3030
&__tooltip {
3131
position: relative;
3232

33-
color: $white;
34-
background-color: $gray-900;
33+
color: styles.$white;
34+
background-color: styles.$gray-900;
3535
padding: 10px;
3636
text-align: center;
3737
text-wrap: balance;
@@ -46,7 +46,7 @@
4646
left: 50%;
4747
transform: translate(-50%, 22px);
4848
border: solid 15px transparent;
49-
border-top-color: $gray-900;
49+
border-top-color: styles.$gray-900;
5050
}
5151

5252
&-left-top {

client/entrypoints/payment-request-settings/style.scss

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
@import '../../styles/abstracts/styles.scss';
1+
@use '../../styles/abstracts/styles';
22

33
.payment-method-settings {
44
&__breadcrumbs {
55
margin-bottom: 40px;
66
}
77

88
&__option-muted-text {
9-
color: #757575;
9+
color: styles.$gray-700;
1010
}
1111

1212
&__option-help-text {
13-
color: #757575;
13+
color: styles.$gray-700;
1414
padding-left: 30px;
1515

1616
@media ( min-width: 600px ) {
@@ -26,10 +26,10 @@
2626
}
2727

2828
&__preview {
29-
border: 1px dashed #ddd;
29+
border: 1px dashed styles.$gray-300;
3030
box-sizing: border-box;
3131
border-radius: 3px;
32-
background-color: #f0f0f0;
32+
background-color: styles.$gray-100;
3333
padding: 16px;
3434
}
3535

@@ -52,7 +52,7 @@
5252
.components-card-body {
5353
padding: calc(16px) calc(24px);
5454

55-
@include breakpoint( '>660px' ) {
55+
@include styles.breakpoint( '>660px' ) {
5656
padding: 24px 24px 24px 24px;
5757
}
5858
}
@@ -62,10 +62,10 @@
6262
display: none;
6363
height: 40px;
6464
margin: 1px 17px 1px 1px; // 1px to accommodate for box-shadow
65-
box-shadow: 0 0 0 1px #ddd;
66-
background: #fff;
65+
box-shadow: 0 0 0 1px styles.$gray-300;
66+
background: styles.$white;
6767

68-
@include breakpoint( '>660px' ) {
68+
@include styles.breakpoint( '>660px' ) {
6969
display: inline-block;
7070
}
7171
}

client/settings/general-settings-section/styles.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
@import '../../styles/abstracts/breakpoints';
1+
@use '../../styles/abstracts/breakpoints';
22

33
.payment-methods {
44
&__unavailable-methods {
55
display: none;
66
margin: 0 0 0 1.5rem;
77

8-
@include breakpoint( '>660px' ) {
8+
@include breakpoints.breakpoint( '>660px' ) {
99
display: flex;
1010
}
1111
}

client/settings/payment-method-icon/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
@import '../../styles/abstracts/styles.scss';
1+
@use '../../styles/abstracts/styles';
22

33
.woocommerce-gateway-stripe__payment-method-icon {
44
display: inline-flex;
55
align-items: center;
66
vertical-align: middle;
77
max-width: 160px;
88

9-
@include breakpoint( '>660px' ) {
9+
@include styles.breakpoint( '>660px' ) {
1010
max-width: inherit;
1111
}
1212

client/settings/payment-request-section/styles.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../styles/abstracts/styles.scss';
1+
@use '../../styles/abstracts/styles';
22

33
.express-checkouts {
44
.express-checkouts-list {
@@ -10,7 +10,7 @@
1010
justify-content: flex-start;
1111
align-items: center;
1212

13-
@include breakpoint( '>660px' ) {
13+
@include styles.breakpoint( '>660px' ) {
1414
padding: 24px 24px 24px 24px;
1515
flex-wrap: nowrap;
1616
}
@@ -35,9 +35,9 @@
3535
flex: 0 0 63.69px;
3636
height: 40px;
3737
margin: 1px 17px 1px 1px; // 1px to accommodate for box-shadow
38-
box-shadow: 0 0 0 1px #ddd;
38+
box-shadow: 0 0 0 1px styles.$gray-300;
3939

40-
@include breakpoint( '>660px' ) {
40+
@include styles.breakpoint( '>660px' ) {
4141
display: flex;
4242
}
4343
}
@@ -47,7 +47,7 @@
4747
font-size: 14px;
4848
font-weight: 600;
4949
line-height: 20px;
50-
color: $gray-900;
50+
color: styles.$gray-900;
5151
margin-bottom: 4px;
5252
}
5353

0 commit comments

Comments
 (0)