0
votes

I want to change bootstrap's default theme-colors with SASS , the problem is when I change a color and compile , it gives me invalid CSS value error.

I've read the docs and saw some tutorials on YouTube but I can't see where is the problem

I'm using bootstrap 5.1.0 , sass 3 this is my scss file:

@import "../../node_modules/bootstrap/scss/variables";

$theme-colors: (
"primary": //some color here,
);

@import "../../node_modules/bootstrap/scss/bootstrap";

and this is the error I get in terminal

PS F:\Coding\projects\sepehr\client\src\styles> sass style.scss custom.css
Error: ("primary": #0d6efd, "secondary": #6c757d, "success": #198754, "info": #0dcaf0, 
"warning": #ffc107, "danger": #dc3545, "light": #f8f9fa, "dark": #212529) isn't a valid 
CSS value.
   ╷
94 │ $theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value") !default;
   │                             ^^^^^^^^^^^^^
   ╵
1

1 Answers

0
votes

You need to import functions and mixins too...

@import "../../node_modules/bootstrap/scss/functions";
@import "../../node_modules/bootstrap/scss/variables";
@import "../../node_modules/bootstrap/scss/mixins";

Also see: Bootstrap 5 - Custom theme-colors not updating classes