小编Joh*_*ien的帖子

导入单个 Bootstrap 组件时覆盖 Bootstrap Sass 变量不起作用

我无法理解如何在不导入所有引导程序的情况下覆盖/添加默认变量。阅读 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)

css sass bootstrap-5

3
推荐指数
1
解决办法
2988
查看次数

标签 统计

bootstrap-5 ×1

css ×1

sass ×1