我无法理解如何在不导入所有引导程序的情况下覆盖/添加默认变量。阅读 Bootstrap 文档提供了两个选项,要么导入所有 bootstrap,要么只导入您需要的部分。
第一个选项,导入所有引导程序:
// Custom.scss
// Option A: Include all of Bootstrap
// Include any default variable overrides here (though functions won't be available)
@import "../node_modules/bootstrap/scss/bootstrap";
// Then add additional custom code here
Run Code Online (Sandbox Code Playgroud)
第二个选项,导入您需要的内容。
// Custom.scss
// Option B: Include parts of Bootstrap
// 1. Include functions first (so you can manipulate colors, SVGs, calc, etc)
@import "../node_modules/bootstrap/scss/functions";
// 2. Include any default variable overrides here
// 3. Include remainder of required Bootstrap stylesheets
@import "../node_modules/bootstrap/scss/variables";
@import "../node_modules/bootstrap/scss/mixins"; …Run Code Online (Sandbox Code Playgroud)