Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid CSS value error while Customizing Bootstrap 5 colors with sass 3

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;
   │                             ^^^^^^^^^^^^^
   ╵
like image 292
Hamed Tahmasebi Avatar asked Aug 24 '21 14:08

Hamed Tahmasebi


1 Answers

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

like image 147
Zim Avatar answered Nov 11 '22 14:11

Zim