From 9dad4760d572eb7cc914d2d344da4011940804a0 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Wed, 23 Oct 2024 08:40:42 -0400 Subject: [PATCH 1/3] fix(brand): Replace all invalid chars in brand sass/css vars Adds a missing `g` flag to do the replacement globally --- src/core/sass/brand.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/sass/brand.ts b/src/core/sass/brand.ts index 20b0f1e6acb..aa0eb06d321 100644 --- a/src/core/sass/brand.ts +++ b/src/core/sass/brand.ts @@ -192,7 +192,7 @@ const brandColorBundle = ( // Create `brand-` prefixed Sass and CSS variables from color.palette for (const colorKey of Object.keys(brand.data?.color?.palette ?? {})) { - const colorVar = colorKey.replace(/[^a-zA-Z0-9_-]+/, "-"); + const colorVar = colorKey.replace(/[^a-zA-Z0-9_-]+/g, "-"); colorVariables.push( `$brand-${colorVar}: ${brand.getColor(colorKey)} !default;`, ); From cbf175985443d2d48daf52d53c8f8e9b324106f1 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Wed, 23 Oct 2024 08:45:04 -0400 Subject: [PATCH 2/3] fix(brand): Drop "gray" and "gray-dark" from Bootstrap color vars These aren't top-level color variables --- src/core/sass/brand.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/sass/brand.ts b/src/core/sass/brand.ts index aa0eb06d321..d5840f48e6e 100644 --- a/src/core/sass/brand.ts +++ b/src/core/sass/brand.ts @@ -266,6 +266,8 @@ const brandBootstrapBundle = ( if (Number(brandBootstrap?.version ?? 5) === 5) { // https://getbootstrap.com/docs/5.3/customize/color/#color-sass-maps bootstrapColorVariables = [ + "black", + "white", "blue", "indigo", "purple", @@ -276,10 +278,6 @@ const brandBootstrapBundle = ( "green", "teal", "cyan", - "black", - "white", - "gray", - "gray-dark" ] } From 1c7709d86bf265103a0862d167ad1f12f332e83d Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Wed, 23 Oct 2024 09:31:27 -0400 Subject: [PATCH 3/3] refactor(brand): Remove Bootstrap version check --- src/core/sass/brand.ts | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/core/sass/brand.ts b/src/core/sass/brand.ts index d5840f48e6e..9004b0653a1 100644 --- a/src/core/sass/brand.ts +++ b/src/core/sass/brand.ts @@ -262,24 +262,21 @@ const brandBootstrapBundle = ( bsVariables.push('// quarto-scss-analysis-annotation { "action": "pop" }'); // Bootstrap Colors from color.palette - let bootstrapColorVariables: string[] = []; - if (Number(brandBootstrap?.version ?? 5) === 5) { - // https://getbootstrap.com/docs/5.3/customize/color/#color-sass-maps - bootstrapColorVariables = [ - "black", - "white", - "blue", - "indigo", - "purple", - "pink", - "red", - "orange", - "yellow", - "green", - "teal", - "cyan", - ] - } + // https://getbootstrap.com/docs/5.3/customize/color/#color-sass-maps + const bootstrapColorVariables = [ + "black", + "white", + "blue", + "indigo", + "purple", + "pink", + "red", + "orange", + "yellow", + "green", + "teal", + "cyan", + ] const bsColors: string[] = [ "/* Bootstrap color variables from _brand.yml */",