11Using Bootstrap CSS & JS
2- ========================
2+ ============================
33
44Want to use Bootstrap (or something similar) in your project? No problem!
55First, 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
10+ $ yarn add bootstrap --dev
1111
12- Importing BootstrapSass
13- ------------------------
12+ Importing BootstrapStyles
13+ --------------------------
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
1616import it from any Sass or JavaScript file. For example, if you already have
1717a ``global.scss `` file, import it from there:
1818
@@ -21,46 +21,18 @@ 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 ``
3030file 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
6537Importing Bootstrap JavaScript
6638------------------------------
@@ -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 ();
@@ -113,5 +85,3 @@ plugins in a similar way:
11385// require 2 CSS files needed
11486require (' bootstrap-star-rating/css/star-rating.css' );
11587require (' bootstrap-star-rating/themes/krajee-svg/theme.css' );
116-
117- .. _`Problems with url()` :https://github.com/webpack-contrib/sass-loader#problems-with-url