Skip to content

Commit 96a706d

Browse files
authored
Merge pull request #777 from cdmoro/docs
docs: update installation page
2 parents 689500c + 1b0402b commit 96a706d

File tree

1 file changed

+91
-15
lines changed

1 file changed

+91
-15
lines changed

apps/docs/docs/getting-started/README.md

Lines changed: 91 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ This project is still in **alpha version**. There is a lot of work to do, if you
1212

1313
## Why BootstrapVue3?
1414

15-
BootstrapVue3 is an attempt to have the [BootstrapVue](https://bootstrap-vue.org/) components in Vue3, Bootstrap 5, and typescript. Another goal is to have components written in a simple and readable way.
15+
BootstrapVue3 is an attempt to have the [BootstrapVue](https://bootstrap-vue.org/) components in Vue3, Bootstrap 5, and typescript. Another goal is to have the components written in a simple and readable way.
1616

17-
As you may suppose, this library is heavily inspired by [BootstrapVue](https://bootstrap-vue.org/), as well as the components properties, events, slots, directives, etc. We want to make it that way because we want to have compatibility with BootstrapVue, so it will be easy to switch between libraries.
17+
As you may suppose, this library is heavily inspired by [BootstrapVue](https://bootstrap-vue.org/), as well as the component properties, events, slots, directives, etc. We want to make it that way because we want to have compatibility with BootstrapVue, so it will be easy to switch between libraries.
1818

19-
## Contribute & support 🙌
19+
## Contribute and Support 🙌
2020

21-
This project is still in **alpha version** so there is a lot of work to do. If you want to contribute you can:
21+
This project is still in **alpha version** so there is much work to do. If you want to contribute you can:
2222

2323
- submit an [issue](https://github.com/cdmoro/bootstrap-vue-3/issues/new)
2424
- or better, a [pull request](https://github.com/cdmoro/bootstrap-vue-3/pulls)
25-
- or even better, visit [my patreon page](https://patreon.com/cdmoro) and support me 😄
25+
- or even better, visit [my Patreon page](https://patreon.com/cdmoro) and support me 😄
2626

27-
### One-time donations
27+
### One-time Donations
2828

2929
Or if you prefer you can make a one-time donation through these channels:
3030

@@ -33,7 +33,7 @@ Or if you prefer you can make a one-time donation through these channels:
3333

3434
## Requisites
3535

36-
In order to use this library you have to install these packages:
36+
To use this library you have to install these packages:
3737

3838
- [Bootstrap](https://getbootstrap.com/docs/5.1/getting-started/introduction/) `5.x.x`
3939
- [Vue.js](https://v3.vuejs.org/) `3.x.x`
@@ -42,7 +42,83 @@ In order to use this library you have to install these packages:
4242

4343
### Installation - Vue.js
4444

45-
To install this library you can use Yarn, NPM, or PNPM:
45+
#### Preferred Installation
46+
47+
- Bootstrap-vue-3 recommends using [unplugin-vue-components](https://github.com/antfu/unplugin-vue-components) for automatic tree-shaking. The following installation method is recommended
48+
- `unplugin-vue-components` may have the side effect feature of also automatically importing _your_ components for ease of use. If you are uncomfortable with this, you may prefer the [**legacy**](#legacy-installation) installation without automatic tree-shaking
49+
50+
Install the necessary packages for `bootstrap-vue-3`:
51+
52+
<CodeGroup>
53+
<CodeGroupItem title="YARN" active>
54+
55+
```bash
56+
yarn add bootstrap bootstrap-vue-3 @popperjs/core
57+
58+
yarn add unplugin-vue-components -D
59+
```
60+
61+
</CodeGroupItem>
62+
63+
<CodeGroupItem title="NPM">
64+
65+
```bash
66+
npm install bootstrap bootstrap-vue-3 @popperjs/core
67+
68+
npm i unplugin-vue-components -D
69+
```
70+
71+
</CodeGroupItem>
72+
73+
<CodeGroupItem title="PNPM">
74+
75+
```bash
76+
pnpm add bootstrap bootstrap-vue-3 @popperjs/core
77+
78+
pnpm add unplugin-vue-components -D
79+
```
80+
81+
</CodeGroupItem>
82+
</CodeGroup>
83+
84+
The following is an example of a basic `vite.config.js/ts`. All you need to do is add **Components** to the Vite **plugins** option, with the additional imports:
85+
86+
```ts
87+
import { defineConfig } from 'vite'
88+
import vue from '@vitejs/plugin-vue'
89+
import Components from 'unplugin-vue-components/vite'
90+
import {BootstrapVue3Resolver} from 'unplugin-vue-components/resolvers'
91+
92+
export default defineConfig({
93+
plugins: [
94+
vue(),
95+
Components({
96+
resolvers: [BootstrapVue3Resolver()]
97+
})
98+
]
99+
})
100+
```
101+
102+
Finally, in your `main.js/ts` import the CSS:
103+
104+
```ts
105+
import 'bootstrap/dist/css/bootstrap.css'
106+
import 'bootstrap-vue-3/dist/bootstrap-vue-3.css'
107+
```
108+
109+
##### Typescript Features
110+
111+
If using TypeScript you will want to add `components.d.ts` to the `include` array in your tsconfig.json:
112+
113+
```json
114+
"include": ["components.d.ts", ...],
115+
```
116+
117+
#### Legacy Installation
118+
119+
- This is the old installation method. It is recommended to use the preferred installation as it will automatically remove unused components, resulting in a lower bundle size. You can, however, still use this installation method
120+
121+
Install the necessary packages for `bootstrap-vue-3`:
46122

47123
<CodeGroup>
48124
<CodeGroupItem title="YARN" active>
@@ -70,13 +146,13 @@ pnpm add bootstrap bootstrap-vue-3 @popperjs/core
70146
</CodeGroupItem>
71147
</CodeGroup>
72148

73-
And in your `main.js/ts`:
149+
Then, add to your `main.js/ts`:
74150

75151
```javascript
76152
import {createApp} from 'vue'
77153
import BootstrapVue3 from 'bootstrap-vue-3'
78154

79-
// Optional, since every component import their Bootstrap functionality
155+
// Optional, since every component imports their Bootstrap functionality
80156
// the following line is not necessary
81157
// import 'bootstrap'
82158

@@ -90,9 +166,9 @@ app.mount('#app')
90166

91167
### Installation - Nuxt.js 3
92168

93-
**Nuxt is not officially supported**. Various Bootstrap JavaScript elements contain references to 'Document' and 'Window', which will cause breaking issues during server-side rendering. Until Bootstrap v5 implements fixes for these, Bootstrap-vue-3 cannot officially support Nuxt3 and SSR applications
169+
**Nuxt is not officially supported**. Various Bootstrap JavaScript elements contain references to 'Document' and 'Window', which will cause breaking issues during server-side rendering. Bootstrap-vue-3 is currently working on a fix for this
94170

95-
As with the Vue.js installation.
171+
As with the Vue.js installation
96172

97173
In your Nuxt3 application, install the necessary packages for `bootstrap-vue-3`
98174

@@ -122,7 +198,7 @@ pnpm add bootstrap bootstrap-vue-3 @popperjs/core
122198
</CodeGroupItem>
123199
</CodeGroup>
124200

125-
Open your `nuxt.config.ts` or `nuxt.config.js` file and configure your application to use `bootstrap-vue-3`. The components will be imported automatically as needed.
201+
Open your `nuxt.config.js/ts` file and configure your application to use `bootstrap-vue-3`. The components will be imported automatically as needed
126202

127203
```javascript
128204
import {defineNuxtConfig} from 'nuxt3'
@@ -145,8 +221,8 @@ Enjoy it in your app without import.
145221

146222
## Comparison with BoostrapVue
147223

148-
As we said, we based this project in [BootstrapVue](https://bootstrap-vue.org/). We consider BootstrapVue as the best implementation of Bootstrap `v4`, so a good approach is to replicate every BootstrapVue component, as well their props, events, etc. and add the new features of Bootstrap `v5`.
224+
As we said, we based this project on [BootstrapVue](https://bootstrap-vue.org/). We consider BootstrapVue as the best implementation of Bootstrap `v4`, so a good approach is to replicate every BootstrapVue component, as well as their props, events, etc., and add the new features of Bootstrap `v5`.
149225

150226
<!-- To follow this, we'll implement a parity list where you can view the progress of covered components. This section is not ready yet. -->
151227

152-
You can view the full list in the following [section](../reference/parityList.md).
228+
You can view the planned compatibility list in the following [section](../reference/parityList.md). It is _not_ a migration guide, which will be finalized upon v1.0.0

0 commit comments

Comments
 (0)