我想用 SASS 更改 bootstrap 默认主题颜色,问题是当我更改颜色并编译时,它会给我无效的 CSS 值错误。
我已阅读文档并在 YouTube 上看到了一些教程,但我看不出问题出在哪里
我正在使用 bootstrap 5.1.0 , sass 3
这是我的 scss 文件:
@import "../../node_modules/bootstrap/scss/variables";
$theme-colors: (
"primary": //some color here,
);
@import "../../node_modules/bootstrap/scss/bootstrap";
这是我在终端中遇到的错误
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;
│ ^^^^^^^^^^^^^
╵
您还需要导入函数和 mixin...
@import "../../node_modules/bootstrap/scss/functions";
@import "../../node_modules/bootstrap/scss/variables";
@import "../../node_modules/bootstrap/scss/mixins";
另请参阅:Bootstrap 5 - 自定义主题颜色不更新类 https://stackoverflow.com/questions/68755179/bootstrap-5-custom-theme-colors-not-updating-classes/68762902#68762902
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)