8
8
<code >{{ bootstrapVersion }}</code > SCSS/CSS
9
9
- jQuery is ** not** required
10
10
11
- ## General
11
+ ## Using module bundlers
12
12
13
13
If you are using module bundlers like [ webpack] ( https://webpack.js.org/ ) ,
14
14
[ rollup.js] ( https://rollupjs.org ) , etc you may prefer to directly include the package into your
@@ -257,7 +257,43 @@ For additional configuration for Vue CLI 3 for using project relative paths for
257
257
various BootstrapVue components, refer to the Vue CLI 3 section of the
258
258
[ Image Src Resolving] ( /docs/reference/images#vue-cli-3-support ) reference page.
259
259
260
- ## Individual components and directives
260
+ ## Selective component and directive inclusion in module bundlers
261
+
262
+ When using a module bundler you can optionally import only specific components groups, components
263
+ and/or directives.
264
+
265
+ ### Component groups and Directives as Vue plugins
266
+
267
+ You can import component groups and directives as Vue plugins by importing the component group
268
+ or directive directory:
269
+
270
+ <!-- eslint-disable import/first, import/no-duplicates -->
271
+
272
+ ``` js
273
+ // This imports all the layout components such as <b-container>, <b-row>, <b-col>:
274
+ import { Layout } from ' bootstrap-vue/es/components'
275
+ Vue .use (Layout)
276
+
277
+ // This imports <b-modal> as well as the v-b-modal directive as a plugin:
278
+ import { Modal } from ' bootstrap-vue/es/components'
279
+ Vue .use (Modal)
280
+
281
+ // This imports <b-card> along with all the <b-card-*> sub-components as a plugin:
282
+ import { Card } from ' bootstrap-vue/es/components'
283
+ Vue .use (Card)
284
+
285
+ // This imports directive v-b-scrollspy as a plugin:
286
+ import { Scrollspy } from ' bootstrap-vue/es/directives'
287
+ Vue .use (Scrollspy)
288
+ ```
289
+
290
+ When importing as plugins, all subcomponents and related directives are imported in most cases. i.e.
291
+ When importing ` <b-nav> ` , all the ` <nav-*> ` sub components are also included, as well all dropdown
292
+ sub components. Component shorthand aliases (if any) are also included in the plugin.
293
+
294
+ Refer to the component and directive documentation for details.
295
+
296
+ ### Individual components and directives
261
297
262
298
If you would like to only pull in a specific component or set of components, you can do this by
263
299
directly importing those components.
@@ -299,37 +335,6 @@ Vue.directive('b-modal', BModalDirective)
299
335
Vue and ES2015 allow for various syntaxes here, so feel free to utilize kebab-casing (shown),
300
336
camelCasing, PascalCasing, and/or object property shorthand.
301
337
302
- ### Component groups and Directives as Vue plugins
303
-
304
- You can also import component groups and directives as Vue plugins by importing the component group
305
- or directive directory:
306
-
307
- <!-- eslint-disable import/first, import/no-duplicates -->
308
-
309
- ``` js
310
- // This imports all the layout components such as <b-container>, <b-row>, <b-col>:
311
- import { Layout } from ' bootstrap-vue/es/components'
312
- Vue .use (Layout)
313
-
314
- // This imports <b-modal> as well as the v-b-modal directive as a plugin:
315
- import { Modal } from ' bootstrap-vue/es/components'
316
- Vue .use (Modal)
317
-
318
- // This imports <b-card> along with all the <b-card-*> sub-components as a plugin:
319
- import { Card } from ' bootstrap-vue/es/components'
320
- Vue .use (Card)
321
-
322
- // This imports directive v-b-scrollspy as a plugin:
323
- import { Scrollspy } from ' bootstrap-vue/es/directives'
324
- Vue .use (Scrollspy)
325
- ```
326
-
327
- When importing as plugins, all subcomponents and related directives are imported in most cases. i.e.
328
- When importing ` <b-nav> ` , all the ` <nav-*> ` sub components are also included, as well all dropdown
329
- sub components. Component shorthand aliases (if any) are also included in the plugin.
330
-
331
- Refer to the component and directive documentation for details.
332
-
333
338
### webpack + Babel
334
339
335
340
When importing components/directives individually, you must configure your app to properly build the
@@ -363,16 +368,28 @@ module.exports = {
363
368
364
369
## Browser
365
370
371
+ Add the Boostrap and BootstrapVue CSS URLs in your HTML ` <head> ` section, followed by the
372
+ required JavaScript files.
373
+
374
+ When supporting older browsers (see [ Browser Support] ( #browser-support ) below), you will need
375
+ to include a polyfill for handling modern JavaScript features before loading Vue and
376
+ BoostrapVue JavaScript files.
377
+
366
378
``` html
367
379
<!-- Add this to <head> -->
380
+
381
+ <!-- Load required Bootstrap and BootstrapVue CSS -->
368
382
<link type =" text/css" rel =" stylesheet" href =" //unpkg.com/bootstrap/dist/css/bootstrap.min.css" />
369
383
<link
370
384
type =" text/css"
371
385
rel =" stylesheet"
372
386
href =" //unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.css"
373
387
/>
374
388
389
+ <!-- Load a polyfill to support older browsers -->
375
390
<script src =" //unpkg.com/@babel/polyfill@latest/dist/polyfill.min.js" ></script >
391
+
392
+ <!-- Load Vue followed by BootstrapVue -->
376
393
<script src =" //unpkg.com/vue@latest/dist/vue.min.js" ></script >
377
394
<script src =" //unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.js" ></script >
378
395
```
@@ -384,11 +401,15 @@ bundler supports es modules, it will automatically prefer it over commonjs.
384
401
385
402
| Variant | Environments | Package path |
386
403
| -------------- | --------------------- | ---------------------------------------------------------------------- |
387
- | ** ES Module ** | webpack 2 / rollup.js | ` es/index.js ` |
404
+ | ** ES Modules ** | webpack 2 / rollup.js | ` es/index.js ` |
388
405
| ** ESM Module** | webpack 2 / rollup.js | ` dist/bootstrap-vue.esm.js ` _ or_ ` dist/bootstrap-vue.esm.min.js ` |
389
406
| commonjs2 | webpack 1 / ... | ` dist/bootstrap-vue.common.js ` _ or_ ` dist/bootstrap-vue.common.min.js ` |
390
407
| UMD | Browser | ` dist/bootstrap-vue.js ` _ or_ ` dist/bootstrap-vue.min.js ` |
391
408
409
+ BootstrapVue relies on ` Popper.js ` (for Tooltip, Popover, and Dropdown positioning), and
410
+ ` vue-functional-data-merge ` (for functional components). These two dependencies are included in
411
+ the ` commonjs2 ` and ` UMD ` bundles.
412
+
392
413
## Migrating a project already using Bootstrap
393
414
394
415
If you've already been using Bootstrap 4, there are a couple adjustments you may need to make to
@@ -403,7 +424,7 @@ your project:
403
424
404
425
### CSS
405
426
406
- BootstrapVue is to be used with Bootstrap 4 CSS/SCSS. Please see
427
+ BootstrapVue is to be used with Bootstrap 4.3 CSS/SCSS. Please see
407
428
[ Browsers and devices] ( https://getbootstrap.com/docs/4.3/getting-started/browsers-devices ) for more
408
429
information about browsers currently supported by Bootstrap 4.
409
430
@@ -418,6 +439,9 @@ If you want to support older IE, Android and IOS devices, you may want to use
418
439
- ` npm install @babel/polyfill `
419
440
- Import it in your app main entry point with ` import '@babel/polyfill' `
420
441
442
+ Or use [ Polyfill.io] ( https://polyfill.io/ ) to dynamically serve browser specific polyfills via ` <script> `
443
+ tags in the HTML ` <head> ` section.
444
+
421
445
## Tooling Support
422
446
423
447
### VS Code + Vetur
0 commit comments