Skip to content

Commit

Permalink
chore: address/ignore SCSS warnings from upgraded sass + stylelint
Browse files Browse the repository at this point in the history
* used sass-migrator to auto-fix use of deprecated global functions like mix(), map-merge()
* used sass-migrator to auto-fix things like @media query syntax
* suppress other SASS deprecation warnings that we cannot fix at this time
* update stylelint rules
  • Loading branch information
bradenmacdonald committed Jan 16, 2025
1 parent 1c94c8d commit dec3f27
Show file tree
Hide file tree
Showing 37 changed files with 261 additions and 210 deletions.
9 changes: 8 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
"ignoreProperties": ["xs", "sm", "md", "lg", "xl", "xxl"]
}],
"alpha-value-notation": "number",
"color-function-notation": "legacy"
"color-function-notation": "legacy",
"import-notation": "string",
"at-rule-empty-line-before": ["always", {
"except": ["blockless-after-same-name-blockless", "first-nested"],
"ignore": ["after-comment"],
"ignoreAtRules": ["import"]
}],
"declaration-block-no-redundant-longhand-properties": null
}
}
2 changes: 2 additions & 0 deletions build-scss.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ var coreResult = sass.renderSync({
file: './scss/core/core.scss',
outputStyle: 'compressed',
importer: tildaImporter,
// For now we can't resolve these warnings as we need to upgrade our 'bootstrap' dependency to do so:
silenceDeprecations: ['abs-percent', 'color-functions', 'import', 'mixed-decls', 'global-builtin'],
});

fs.writeFileSync('./dist/paragon.css', coreResult.css);
13 changes: 7 additions & 6 deletions scss/core/_exports.module.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:map";
// Grid breakpoints
//
// Define the minimum dimensions at which your layout will change,
Expand All @@ -13,10 +14,10 @@ $grid-breakpoints: (
) !default;

:export {
xs: map-get($grid-breakpoints, "xs");
sm: map-get($grid-breakpoints, "sm");
md: map-get($grid-breakpoints, "md");
lg: map-get($grid-breakpoints, "lg");
xl: map-get($grid-breakpoints, "xl");
xxl: map-get($grid-breakpoints, "xxl");
xs: map.get($grid-breakpoints, "xs");
sm: map.get($grid-breakpoints, "sm");
md: map.get($grid-breakpoints, "md");
lg: map.get($grid-breakpoints, "lg");
xl: map.get($grid-breakpoints, "xl");
xxl: map.get($grid-breakpoints, "xxl");
}
16 changes: 9 additions & 7 deletions scss/core/_functions.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "sass:map";
@use "sass:meta";
@import "~bootstrap/scss/functions";

//
Expand All @@ -15,20 +17,20 @@
$base-color: #808080 !default;
$color-level: 500 !default;

@if map-has-key($theme-colors, $color-name) {
$base-color: map-get($theme-colors, $color-name);
@if map.has-key($theme-colors, $color-name) {
$base-color: map.get($theme-colors, $color-name);
}

@if type-of($variant) == "number" {
@if meta.type-of($variant) == "number" {
$color-level: $variant;
}

@else if map-has-key($element-color-levels, $variant) {
$color-level: map-get($element-color-levels, $variant);
@else if map.has-key($element-color-levels, $variant) {
$color-level: map.get($element-color-levels, $variant);
}

@if map-has-key($theme-color-levels, "#{$color-name}-#{$color-level}") {
@return map-get($theme-color-levels, "#{$color-name}-#{$color-level}");
@if map.has-key($theme-color-levels, "#{$color-name}-#{$color-level}") {
@return map.get($theme-color-levels, "#{$color-name}-#{$color-level}");
}

@return $base-color;
Expand Down
3 changes: 2 additions & 1 deletion scss/core/_typography.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:map";
@import "~bootstrap/scss/type";

@mixin mobile-type {
Expand Down Expand Up @@ -40,7 +41,7 @@
}
}

@media (max-width: map-get($grid-breakpoints, "sm")) {
@media (max-width: map.get($grid-breakpoints, "sm")) {
@include mobile-type;
}

Expand Down
3 changes: 2 additions & 1 deletion scss/core/_utilities.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:map";
@import "~bootstrap/scss/utilities";

// Add background, border, and text color utilities
Expand Down Expand Up @@ -81,7 +82,7 @@ $color-levels: 100, 200, 300, 400, 500, 600, 700, 800, 900;

// Define classes for z-index
$indexes: () !default;
$indexes: map-merge(
$indexes: map.merge(
(
0: 0,
1: 200,
Expand Down
Loading

0 comments on commit dec3f27

Please sign in to comment.