4
4
If you are using module bundlers such as Webpack, Rollup, Laravel elixir/mix, etc you may prefer directly include package
5
5
into your project. To get started use yarn or npm to get latest version.
6
6
7
- ``` sh
7
+
8
+ 1 . Download dependencies:
9
+ ``` bash
8
10
# Using YARN
9
11
yarn add bootstrap-vue
12
+ yarn add bootstrap@4.0.0-alpha.6
13
+ yarn add -D style-loader
10
14
11
15
# Using NPM
12
16
npm install --save bootstrap-vue
13
17
```
14
18
15
- Register BootstrapVue in your app entrypoint:
16
-
19
+ 2 . Register BootstrapVue in your app entrypoint:
17
20
``` js
18
21
import Vue from ' vue'
19
22
import BootstrapVue from ' bootstrap-vue' ;
20
23
21
24
Vue .use (BootstrapVue);
22
25
```
23
26
24
- Import styles using style-loader:
27
+ 3 . Import styles using style-loader:
25
28
``` js
26
29
import ' bootstrap/dist/css/bootstrap.css'
27
30
import ' bootstrap-vue/dist/bootstrap-vue.css'
28
31
```
29
- If style-loader is not available, you have to manually include both bootstrap and bootstrap-vue css files in your css bundle
32
+
33
+ ##### For users of Webpack or Webpack-Simple from ` vue-cli ` follow these instructions:
34
+ 1 . Download the dependencies:
35
+ ``` bash
36
+ yarn add bootstrap-vue
37
+ yarn add bootstrap@4.0.0-alpha.6
38
+ yarn add -D style-loader
39
+ ```
40
+
41
+ 2 . In ` src/main.js ` , add the following lines, in priority order:
42
+ ``` js
43
+ import Vue from ' vue' ;
44
+ /* ( there may be other imports here ) */
45
+ import BootstrapVue from ' bootstrap-vue/dist/bootstrap-vue.esm' ;
46
+ import ' bootstrap-vue/dist/bootstrap-vue.css' ;
47
+ import ' bootstrap/dist/css/bootstrap.css' ;
48
+ /* ( there may be other imports here ) */
49
+
50
+ Vue .use (BootstrapVue);
51
+ ```
52
+
53
+ #### Note on style-loader:
54
+ If you are unable or do not want to add style-loader as a developer dependency, you have to
55
+ manually include both [ Bootstrap's] ( https://v4-alpha.getbootstrap.com/getting-started/download/ )
56
+ and [ BootstrapVue's] ( https://unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.css ) CSS files
57
+ in your bundle or reference them from ` static/ ` via ` index.html ` .
58
+
30
59
31
60
#### Using individual components and directives
32
61
If for any reason just want to use a specific component, you can do this by directly importing that component.
33
62
This is not recommended as entire package gzipped size is ~ 15Kb and requires a supported vue bundler.
63
+
34
64
``` js
35
65
import {bAlert , bBtn , bCollapse } from ' bootstrap-vue/lib/components'
36
66
import (bToggle, bScrollspy} from ' bootstrap-vue/lib/directives'
@@ -48,8 +78,6 @@ new Vue({
48
78
},
49
79
// ...
50
80
})
51
-
52
-
53
81
` ` `
54
82
55
83
### CDN (Browser)
0 commit comments