Skip to content

Commit 4e9f629

Browse files
cdmh219cdhenley219
and
cdhenley219
authored
DATAP-1580 - fix sass use/include deprecation warnings (#554)
* - Updated CRACO config to allow sass-loader library to use modern APIs (not legacy) - Updated CRACO config to allow sass-loader library to automatically load node_modules and src paths so that Sass files are found on those paths by default, and absolute paths are not needed when importing Sass files - Updated CRACO config to use relative paths when referencing files in the components and css folders throughout the app - Made fixes to referenced Sass imports in several stylesheets based on Sass config updates - Defined true entry point stylesheet in base.scss, which holds all design system configuration and is referenced in all other stylesheets - Began updating all component stylesheets to refer to base.scss, as well as removal of unnecessary references to design system files * For each component stylesheet: - Removed unnecessary references to design system folders - Added base.scss as a reference (even if not used - good to have entrypoint stylesheets in other stylesheets) - Fixed additional deprecation warnings related to file * Successful prod build * Changed @import statements to @use * Changed @import to @use in PillPanel.scss --------- Co-authored-by: cdhenley219 <[email protected]>
1 parent d3fd0b6 commit 4e9f629

38 files changed

+117
-136
lines changed

craco.config.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ const { ProvidePlugin } = require('webpack');
1717

1818
module.exports = {
1919
webpack: {
20-
alias: {},
20+
alias: {
21+
components: path.resolve(__dirname, 'src/components'),
22+
css: path.resolve(__dirname, 'src/css')
23+
},
2124
configure: (webpackConfig, { env, paths }) => {
2225
const strReplaceLoader = {
2326
// test: /constants\/index\.js$/,
@@ -82,4 +85,14 @@ module.exports = {
8285
},
8386
},
8487
],
88+
style: {
89+
sass: {
90+
loaderOptions: {
91+
api: 'modern',
92+
sassOptions: {
93+
loadPaths: ['node_modules', 'src']
94+
}
95+
}
96+
}
97+
}
8598
};

dist/ccdb5.css

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ccdb5.css.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ccdb5.js

+45-45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ccdb5.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/ActionBar/ActionBar.scss

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
2-
@use '@cfpb/cfpb-design-system/src/utilities' as *;
3-
@import '../../css/base';
2+
@use 'css/base' as *;
43

54
.action-bar {
65
border: 1px solid var(--gray-40);

src/components/Charts/RowChart/RowChart.scss

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
2-
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
3-
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
4-
@import '../../../css/base';
1+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
2+
@use 'css/base' as *;
53

64
.row-chart-section {
75
margin-top: $grid-gutter-width;

src/components/ComplaintDetail/ComplaintDetail.scss

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
2-
@use '@cfpb/cfpb-design-system/src/utilities' as *;
3-
@import '../../css/base';
2+
@use 'css/base' as *;
43

54
.card-container {
65
max-width: 100%;

src/components/Dialogs/DataExport/DataExport.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
22
@use '@cfpb/cfpb-design-system/src/utilities' as *;
3-
@import '../../../css/base';
3+
@use 'css/base' as *;
44

55
.export-modal {
66
.body {

src/components/Dialogs/RootModal.scss

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
@use 'sass:math';
21
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
3-
@use '@cfpb/cfpb-design-system/src/utilities' as *;
4-
@import '../../css/base';
2+
@use 'css/base' as *;
53

64
.modal-overlay {
75
position: fixed;

src/components/Filters/Aggregation/Aggregation.scss

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
@use 'sass:math';
2-
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
3-
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
4-
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
5-
@import '../../../css/base';
2+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
3+
@use 'css/base' as *;
64

75
.aggregation {
86
ul {

src/components/Filters/Aggregation/AggregationBranch/AggregationBranch.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../../../css/base';
1+
@use 'css/base' as *;
22

33
li.aggregation-branch {
44
&.parent {

src/components/Filters/CollapsibleFilter/CollapsibleFilter.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../../css/base';
1+
@use 'css/base' as *;
22

33
.o-expandable {
44
margin-bottom: 0;

src/components/Filters/DateFilter.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../css/base';
1+
@use 'css/base' as *;
22

33
.date-filter {
44
h4 {

src/components/Filters/FilterPanel.scss

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
2-
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
3-
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
4-
@import '../../css/base';
1+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
2+
@use 'css/base' as *;
53

64
.filter-panel {
75
padding: $gutter-normal;
6+
border-top: 1px solid var(--gray-40);
7+
border-right: 1px solid var(--gray-40);
8+
background: var(--gray-5);
89

910
@media screen and (min-width: $layout-breakpoint-desktop-min) {
1011
padding: $grid-gutter-width;
1112
}
12-
border-top: 1px solid var(--gray-40);
13-
border-right: 1px solid var(--gray-40);
14-
background: var(--gray-5);
1513

1614
@media screen and (max-width: $layout-breakpoint-phone-max) {
1715
border-right: none;

src/components/Filters/FilterPanelToggle.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../css/base';
1+
@use 'css/base' as *;
22

33
.filter-panel-toggle {
44
@media screen and (min-width: $layout-breakpoint-superwide-min) {

src/components/List/ComplaintCard/ComplaintCard.scss

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
2-
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
3-
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
4-
@import '../../../css/base';
1+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
2+
@use 'css/base' as *;
53

64
// Reset interfering Captial Framework style
75
.card-container .card .card-left {

src/components/List/ListPanel/ListPanel.scss

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
2-
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
3-
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
4-
@import '../../../css/base';
1+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
2+
@use 'css/base' as *;
53

64
.list-panel {
75
// The "No results were found for your search" heading.

src/components/Loading/Loading.scss

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
@use 'sass:math';
2-
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
3-
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
4-
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
5-
@import '../../css/base';
1+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
2+
@use 'css/base' as *;
63

74
.light-box {
85
position: fixed;

src/components/Map/TileChartMap/TileChartMap.scss

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
*
66
* License: www.highcharts.com/license
77
*/
8-
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
9-
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
10-
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
11-
@import '../../../css/base';
8+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
9+
@use 'css/base' as *;
1210

1311
.highcharts-container {
1412
position: relative;

src/components/RefineBar/RefineBar.scss

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
@use 'sass:math';
2-
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
3-
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
4-
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
5-
@import '../../css/base';
6-
@import '../select';
2+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
3+
@use 'css/base' as *;
4+
@use '../select' as *;
75

86
.refine-bar {
97
section {

src/components/RefineBar/Separator.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../css/base';
1+
@use 'css/base' as *;
22

33
.separator {
44
border-left: solid 1px var(--gray-40);

src/components/Search/AdvancedTips/ComplexExample.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../../css/base';
1+
@use 'css/base' as *;
22

33
.complex-example {
44
button { margin: $gutter-narrow 0; }

src/components/Search/Hero/Hero.scss

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use 'sass:math';
22
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
3-
@use '@cfpb/cfpb-design-system/src/utilities' as *;
4-
@import '../../../css/base';
3+
@use 'css/base' as *;
54

65
.content__hero {
76
padding-bottom: math.div(30px, $base-font-size-px) + rem;

src/components/Search/Pill.scss

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use 'sass:math';
22
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
3-
@use '@cfpb/cfpb-design-system/src/utilities' as *;
43

54
.pill {
65
padding: math.div($grid-gutter-width, 3) 30px math.div($grid-gutter-width, 3) math.div($grid-gutter-width, 3);

src/components/Search/PillPanel.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@use 'sass:math';
2-
@import '../../css/base';
2+
@use 'css/base' as *;
33

44
.pill-panel {
55
padding-right: $gutter-narrow;

src/components/Search/SearchBar.scss

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
@use 'sass:math';
2-
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
3-
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
4-
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
5-
@import '../../css/base';
2+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
3+
@use 'css/base' as *;
64

75
.search-bar {
86
@media screen and (max-width: $layout-breakpoint-phone-max) {

src/components/Search/SearchPanel.scss

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
@use 'node_modules/@cfpb/cfpb-design-system/src/abstracts' as *;
2-
@use 'node_modules/@cfpb/cfpb-design-system/src/base' as *;
3-
@use 'node_modules/@cfpb/cfpb-design-system/dist/index.css' as *;
4-
@import '../../css/base';
1+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
2+
@use 'css/base' as *;
53

64
.search-panel {
75
padding: $grid-gutter-width;
86
border-right: 1px solid var(--gray-40);
7+
background-color: var(--gray-5);
98

109
@media screen and (min-width: $layout-breakpoint-desktop-min) {
1110
padding: $grid-gutter-width;
@@ -15,7 +14,6 @@
1514
padding: $gutter-narrow;
1615
min-height: 150px;
1716
}
18-
background-color: var(--gray-5);
1917
}
2018

2119
.date-subscript {

src/components/TabbedNavigation.scss

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use 'sass:math';
22
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
3-
@use '@cfpb/cfpb-design-system/src/utilities' as *;
4-
@import '../css/base';
3+
@use 'css/base';
54

65
.tabbed-navigation {
76
margin-top: 30px;

src/components/Tour/Tour.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@use '../../../node_modules/intro.js/introjs.css' as *;
22

33
// Intro.js styles
4-
@import '../../css/base';
4+
@use 'css/base' as *;
55

66
.introjs-tooltip.wide {
77
max-width: 80vw !important;

src/components/Trends/FocusHeader.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
@import '../TabbedNavigation';
1+
@use 'css/base' as *;
2+
@use '../TabbedNavigation';
23

34
.focus-header {
45
.clear-focus {

src/components/Trends/LensTabs.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../TabbedNavigation';
1+
@use '../TabbedNavigation';
22

33
.tabbed-navigation {
44
&.lens {

src/components/Trends/TrendDepthToggle.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../TabbedNavigation';
1+
@use '../TabbedNavigation';
22

33
.trend-depth-toggle {
44
background: var(--gray-10);

src/components/Trends/TrendsPanel/TrendsPanel.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../../css/base';
1+
@use 'css/base' as *;
22

33
.trends-panel {
44
.refine-bar {

src/components/Typeahead/Typeahead.scss

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
2-
@use '@cfpb/cfpb-design-system/src/utilities' as *;
3-
@import '../../css/base';
2+
@use 'css/base' as *;
43

54
.typeahead {
65
input {

src/components/select.scss

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use 'sass:math';
22
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
3-
@use '@cfpb/cfpb-design-system/src/utilities' as *;
43

54
// select
65
$select-border: var(--gray-40);

src/css/App.scss

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
// Import Design System Components.
2-
@use '@cfpb/cfpb-design-system/src/index' as *;
32
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
4-
@use '@cfpb/cfpb-design-system/src/base' as *;
5-
@use '@cfpb/cfpb-design-system/src/utilities' as *;
63

74
// no atomic components
8-
@import 'base';
9-
@import '../components/Print/print';
10-
@include define-custom-props;
11-
@include licensed-font;
5+
@use 'base' as *;
6+
@use 'components/Print/print' as *;
7+
128

139
// Icon font path
1410
$cf-icon-path: '../css/fonts';
@@ -203,4 +199,4 @@ $cf-fonts-path: '/static/fonts';
203199

204200
::-ms-clear {
205201
display: none;
206-
}
202+
}

src/css/base.scss

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
@use 'sass:math';
2-
@use '@cfpb/cfpb-design-system/src/abstracts/index' as *;
3-
@use '@cfpb/cfpb-design-system/src/base/index' as *;
4-
@use '@cfpb/cfpb-design-system/src/index' as *;
5-
@use '@cfpb/cfpb-design-system/src/utilities' as *;
2+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
3+
@use '@cfpb/cfpb-design-system/src/base' as *;
4+
@use '@cfpb/cfpb-design-system/dist/index.css' as *;
5+
@include define-custom-props;
6+
@include licensed-font;
67

78

89
/* ==========================================================================

0 commit comments

Comments
 (0)