Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Otto <markd.otto@gmail.com>2021-01-15 03:21:21 +0300
committerGitHub <noreply@github.com>2021-01-15 03:21:21 +0300
commit803e49d928b28c19fa422191eb4378faf26858a1 (patch)
tree831d345dc3b5b61b808f230e42cd13769fbabceb
parent9bec37a77bcf6bc0f993687f1cbb1a99780246a6 (diff)
Clarifies Sass variable defaults, adds bootstrap-npm-starter callout (#32795)
* Clarify Sass import and customize docs for how to modify variable defaulst * Add an npm starter project callout to a few pages * Update callout-info-npm-starter.md Co-authored-by: XhmikosR <xhmikosr@gmail.com>
-rw-r--r--site/content/docs/5.0/customize/sass.md24
-rw-r--r--site/content/docs/5.0/getting-started/build-tools.md4
-rw-r--r--site/content/docs/5.0/getting-started/download.md4
-rw-r--r--site/layouts/partials/callout-info-npm-starter.md1
4 files changed, 30 insertions, 3 deletions
diff --git a/site/content/docs/5.0/customize/sass.md b/site/content/docs/5.0/customize/sass.md
index d21dff7aa5..eda2d83fb8 100644
--- a/site/content/docs/5.0/customize/sass.md
+++ b/site/content/docs/5.0/customize/sass.md
@@ -42,6 +42,8 @@ In your `custom.scss`, you'll import Bootstrap's source Sass files. You have two
// Option A: Include all of Bootstrap
@import "../node_modules/bootstrap/scss/bootstrap";
+
+// Add custom code after this
```
```scss
@@ -53,6 +55,8 @@ In your `custom.scss`, you'll import Bootstrap's source Sass files. You have two
@import "../node_modules/bootstrap/scss/variables";
@import "../node_modules/bootstrap/scss/mixins";
+// Include custom variable default overrides here
+
// Optional
@import "../node_modules/bootstrap/scss/root";
@import "../node_modules/bootstrap/scss/reboot";
@@ -70,21 +74,35 @@ Every Sass variable in Bootstrap includes the `!default` flag allowing you to ov
You will find the complete list of Bootstrap's variables in `scss/_variables.scss`. Some variables are set to `null`, these variables don't output the property unless they are overridden in your configuration.
-Variable overrides within the same Sass file can come before or after the default variables. However, when overriding across Sass files, your overrides must come before you import Bootstrap's Sass files.
+Variable overrides must come after our functions, variables, and mixins are imported, but before the rest of the imports.
Here's an example that changes the `background-color` and `color` for the `<body>` when importing and compiling Bootstrap via npm:
```scss
+// Required
+@import "../node_modules/bootstrap/scss/functions";
+@import "../node_modules/bootstrap/scss/variables";
+@import "../node_modules/bootstrap/scss/mixins";
+
// Your variable overrides
$body-bg: #000;
$body-color: #111;
// Bootstrap and its default variables
-@import "../node_modules/bootstrap/scss/bootstrap";
+
+// Optional
+@import "../node_modules/bootstrap/scss/root";
+@import "../node_modules/bootstrap/scss/reboot";
+@import "../node_modules/bootstrap/scss/type";
+// etc
```
Repeat as necessary for any variable in Bootstrap, including the global options below.
+{{< callout info >}}
+{{< partial "callout-info-npm-starter.md" >}}
+{{< /callout >}}
+
## Maps and loops
Bootstrap includes a handful of Sass maps, key value pairs that make it easier to generate families of related CSS. We use Sass maps for our colors, grid breakpoints, and more. Just like Sass variables, all Sass maps include the `!default` flag and can be overridden and extended.
@@ -139,7 +157,7 @@ $theme-colors: map-remove($theme-colors, "info", "light", "dark");
@import "../node_modules/bootstrap/scss/root";
@import "../node_modules/bootstrap/scss/reboot";
@import "../node_modules/bootstrap/scss/type";
-...
+// etc
```
## Required keys
diff --git a/site/content/docs/5.0/getting-started/build-tools.md b/site/content/docs/5.0/getting-started/build-tools.md
index fcee8cc260..d0286375ee 100644
--- a/site/content/docs/5.0/getting-started/build-tools.md
+++ b/site/content/docs/5.0/getting-started/build-tools.md
@@ -65,6 +65,10 @@ Our [package.json]({{< param repo >}}/blob/v{{< param current_version >}}/packag
</tbody>
</table>
+{{< callout info >}}
+{{< partial "callout-info-npm-starter.md" >}}
+{{< /callout >}}
+
## Sass
Bootstrap uses [Dart Sass](https://sass-lang.com/dart-sass) for compiling our Sass source files into CSS files (included in our build process), and we recommend you do the same if you're compiling Sass using your own asset pipeline. We previously used Node Sass for Bootstrap v4, but LibSass and packages built on top of it, including Node Sass, are now [deprecated](https://sass-lang.com/blog/libsass-is-deprecated).
diff --git a/site/content/docs/5.0/getting-started/download.md b/site/content/docs/5.0/getting-started/download.md
index af2d5a5def..48578572b0 100644
--- a/site/content/docs/5.0/getting-started/download.md
+++ b/site/content/docs/5.0/getting-started/download.md
@@ -70,6 +70,10 @@ Bootstrap's `package.json` contains some additional metadata under the following
- `sass` - path to Bootstrap's main [Sass](https://sass-lang.com/) source file
- `style` - path to Bootstrap's non-minified CSS that's been precompiled using the default settings (no customization)
+{{< callout info >}}
+{{< partial "callout-info-npm-starter.md" >}}
+{{< /callout >}}
+
### yarn
Install Bootstrap in your Node.js powered apps with [the yarn package](https://yarnpkg.com/en/package/bootstrap):
diff --git a/site/layouts/partials/callout-info-npm-starter.md b/site/layouts/partials/callout-info-npm-starter.md
new file mode 100644
index 0000000000..bbd3897b57
--- /dev/null
+++ b/site/layouts/partials/callout-info-npm-starter.md
@@ -0,0 +1 @@
+**Get started with Bootstrap via npm with our starter project!** Head to the [twbs/bootstrap-npm-starter](https://github.com/twbs/bootstrap-npm-starter) template repository to see how to build and customize Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons.