2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-11 18:02:28 +03:00

docs: switch to fenced codeblocks (#31806)

This commit is contained in:
XhmikosR
2020-10-19 12:56:49 +03:00
committed by GitHub
parent 48177c946f
commit e6618a6ebb
43 changed files with 494 additions and 446 deletions
@@ -14,17 +14,17 @@ toc: true
Import [Bootstrap's JavaScript]({{< docsref "/getting-started/javascript" >}}) by adding this line to your app's entry point (usually `index.js` or `app.js`):
{{< highlight js >}}
```js
// You can specify which plugins you need
import { Tooltip, Toast, Popover } from 'bootstrap';
{{< /highlight >}}
```
Alternatively, if you only need just a few of our plugins, you may **import plugins individually** as needed:
{{< highlight js >}}
```js
import Alert from 'bootstrap/js/dist/alert';
...
{{< /highlight >}}
```
Bootstrap depends on [Popper](https://popper.js.org/), which is specified in the `peerDependencies` property.
This means that you will have to make sure to add it to your `package.json` using `npm install popper.js`.
@@ -37,14 +37,14 @@ To enjoy the full potential of Bootstrap and customize it to your needs, use the
First, create your own `_custom.scss` and use it to override the [built-in custom variables]({{< docsref "/customize/sass" >}}). Then, use your main Sass file to import your custom variables, followed by Bootstrap:
{{< highlight scss >}}
```scss
@import "custom";
@import "~bootstrap/scss/bootstrap";
{{< /highlight >}}
```
For Bootstrap to compile, make sure you install and use the required loaders: [sass-loader](https://github.com/webpack-contrib/sass-loader), [postcss-loader](https://github.com/webpack-contrib/postcss-loader) with [Autoprefixer](https://github.com/postcss/autoprefixer#webpack). With minimal setup, your webpack config should include this rule or similar:
{{< highlight js >}}
```js
// ...
{
test: /\.(scss)$/,
@@ -75,19 +75,19 @@ For Bootstrap to compile, make sure you install and use the required loaders: [s
}]
}
// ...
{{< /highlight >}}
```
### Importing Compiled CSS
Alternatively, you may use Bootstrap's ready-to-use CSS by simply adding this line to your project's entry point:
{{< highlight js >}}
```js
import 'bootstrap/dist/css/bootstrap.min.css';
{{< /highlight >}}
```
In this case you may use your existing rule for `css` without any special modifications to webpack config, except you don't need `sass-loader` just [style-loader](https://github.com/webpack-contrib/style-loader) and [css-loader](https://github.com/webpack-contrib/css-loader).
{{< highlight js >}}
```js
// ...
module: {
rules: [
@@ -101,4 +101,4 @@ module: {
]
}
// ...
{{< /highlight >}}
```