Bootstrap SCSS on NPM does not generate bg-dark classes #39794
-
Prerequisites
Describe the issueI'm tryna customize bootstrap for a website I'm building but I've came accross an issue: That makes a big issue on my website as my navbar is using this class. Here is the scss part where I import bootstrap: @import "../node_modules/bootstrap/scss/functions";
$gold: #ffcc00;
$red: #e72020;
$yellow: #c99e12;
$blue: #1e90ff;
$dark-blue: #093085;
$hestia-blue: #3b4776;
$lighty-hestia-blue: #b2d3fa;
$green: #288509;
$greeny: #9BA841;
$theme-colors: (
"primary": $gold,
"secondary": $hestia-blue,
"tertiary": $lighty-hestia-blue,
"success": $green,
"info": $blue,
"warning": $yellow,
"danger": $red,
"blue": $blue,
"red": $red,
"yellow": $yellow,
"gold": $gold,
"hestia-blue": $hestia-blue,
"light-hes-blue": $lighty-hestia-blue,
"green": $green,
"greeny": $greeny,
"dark-blue": $dark-blue,
);
@import "../node_modules/bootstrap/scss/variables";
@import "../node_modules/bootstrap/scss/variables-dark";
@import "../node_modules/bootstrap/scss/bootstrap";
@import "../node_modules/bootstrap/scss/utilities";
// rest of customization after those statements Reduced test casesI cannot do a reduced test case as I cannot seem to make bootstrap work with customization with SCSS on codepen and don't know how to make one that works either. What operating system(s) are you seeing the problem on?Windows What browser(s) are you seeing the problem on?Chrome What version of Bootstrap are you using?5.3.3 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I found a workaround using |
Beta Was this translation helpful? Give feedback.
-
I have converted your issue to a discussion first @TheDogHusky So in order to make $theme-colors: (
// ...
"dark": $dark
); And to have access to Hope it can help! |
Beta Was this translation helpful? Give feedback.
-
Seems like a fix ! A little workaround I've made until I've clarified how scss overwriting with variables.scss could work: |
Beta Was this translation helpful? Give feedback.
I have converted your issue to a discussion first @TheDogHusky
Our
.bg-*
classes are generated from the$theme-colors
map. In your example, you override the$theme-colors
and don't define thedark
key so.bg-dark
won't be generated. I also means that your$theme-colors
will generated a.bg-light-hes-blue
class for instance.So in order to make
.bg-dark
available, you can add the following:And to have access to
$dark
, you'll need to importvariables.scss
before defining the map.Hope it can help!