8000 Update bootstrap.rst · symfony/symfony-docs@38a5435 · GitHub
[go: up one dir, main page]

Skip to content

Commit 38a5435

Browse files
Eorasjaviereguiluz
authored andcommitted
Update bootstrap.rst
1 parent ee310f1 commit 38a5435

File tree

1 file changed

+16
-44
lines changed

1 file changed

+16
-44
lines changed

frontend/encore/bootstrap.rst

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
Using Bootstrap CSS & JS
2-
========================
2+
============================
33

44
Want to use Bootstrap (or something similar) in your project? No problem!
55
First, install it. To be able to customize things further, we'll install
6-
``bootstrap-sass``:
6+
``bootstrap``:
77

88
.. code-block:: terminal
99
10-
$ yarn add bootstrap-sass --dev
11-
12-
Importing Bootstrap Sass
10+
$ yarn add bootstrap --dev
11+
12+
Importing Bootstrap 4
1313
------------------------
1414

15-
Now that ``bootstrap-sass`` lives in your ``node_modules`` directory, you can
15+
Now that ``bootstrap`` lives in your ``node_modules`` directory, you can
1616
import it from any Sass or JavaScript file. For example, if you already have
1717
a ``global.scss`` file, import it from there:
1818

@@ -21,49 +21,21 @@ a ``global.scss`` file, import it from there:
2121
// assets/css/global.scss
2222
2323
// customize some Bootstrap variables
24-
$brand-primary: darken(#428bca, 20%);
24+
$primary: darken(#428bca, 20%);
2525
2626
// the ~ allows you to reference things in node_modules
27-
@import '~bootstrap-sass/assets/stylesheets/bootstrap';
27+
@import "~bootstrap/scss/bootstrap";
2828
29-
That's it! This imports the ``node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss``
29+
That's it! This imports the ``node_modules/bootstrap/scss/bootstrap.scss``
3030
file into ``global.scss``. You can even customize the Bootstrap variables first!
3131

3232
.. tip::
3333

3434
If you don't need *all* of Bootstrap's features, you can include specific files
35-
in the ``bootstrap`` directory instead - e.g. ``~bootstrap-sass/assets/stylesheets/bootstrap/alerts``.
36-
37-
After including ``bootstrap-sass``, your Webpack builds might become slow. To fix
38-
this, you can use the ``resolveUrlLoader`` option:
39-
40-
.. code-block:: diff
41-
42-
// webpack.config.js
43-
Encore
44-
+ .enableSassLoader(function(sassOptions) {}, {
45-
+ resolveUrlLoader: false
46-
+ })
47-
;
48-
49-
This disables the ``resolve-url-loader`` in Webpack, which means that any
50-
``url()`` paths in your Sass files must now be relative to the original source
51-
entry file instead of whatever file you're inside of (see `Problems with url()`_).
52-
To load Bootstrap, you'll need to override the path to its icons:
53-
54-
.. code-block:: diff
55-
56-
// assets/css/global.scss
57-
58-
+ $icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/";
59-
60-
+ // set if you're also including font-awesome
61-
+ // $fa-font-path: "~font-awesome/fonts";
62-
63-
@import '~bootstrap-sass/assets/stylesheets/bootstrap';
35+
in the ``bootstrap`` directory instead - e.g. ``~bootstrap/scss/alert``.
6436

6537
Importing Bootstrap JavaScript
66-
------------------------------
38+
---------------------------------
6739

6840
Bootstrap JavaScript requires jQuery, so make sure you have this installed:
6941

@@ -86,16 +58,16 @@ variable. Now, require bootstrap from any of your JavaScript files:
8658

8759
.. code-block:: javascript
8860
89-
// main.js
61+
// app.js
9062
91-
var $ = require('jquery');
63+
const $ = require('jquery');
9264
// JS is equivalent to the normal "bootstrap" package
9365
// no need to set this to a variable, just require it
94-
require('bootstrap-sass');
66+
require('bootstrap');
9567
9668
// or you can include specific pieces
97-
// require('bootstrap-sass/javascripts/bootstrap/tooltip');
98-
// require('bootstrap-sass/javascripts/bootstrap/popover');
69+
// require('bootstrap/js/dist/tooltip');
70+
// require('bootstrap/js/dist/popover');
9971
10072
$(document).ready(function() {
10173
$('[data-toggle="popover"]').popover();

0 commit comments

Comments
 (0)
0