Skip to content

Commit aead8f0

Browse files
authored
Merge pull request #367 from messenjer/feature/nuxt-library-author
feat: support for library authors for nuxt3
2 parents 9ecd723 + 10388dd commit aead8f0

File tree

3 files changed

+64
-3
lines changed

3 files changed

+64
-3
lines changed

docs/getting-started/README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ In order to use this library you have to install these packages:
4040

4141
## Install
4242

43-
### Bundlers
43+
### Installation - Vue.js
4444

4545
To install this library you can use Yarn or NPM:
4646

@@ -80,6 +80,51 @@ app.use(BootstrapVue3)
8080
app.mount('#app')
8181
```
8282

83+
### Installation - Nuxt.js 3
84+
85+
As with the Vue.js installation.
86+
87+
In your Nuxt3 application, install `bootstrap-vue-3`
88+
89+
<CodeGroup>
90+
<CodeGroupItem title="YARN" active>
91+
92+
```bash
93+
yarn add bootstrap bootstrap-vue-3
94+
```
95+
96+
</CodeGroupItem>
97+
98+
<CodeGroupItem title="NPM">
99+
100+
```bash
101+
npm install bootstrap bootstrap-vue-3
102+
```
103+
104+
</CodeGroupItem>
105+
</CodeGroup>
106+
107+
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.
108+
109+
```javascript
110+
import {defineNuxtConfig} from 'nuxt3'
111+
112+
export default defineNuxtConfig({
113+
modules: ['bootstrap-vue-3/nuxt'],
114+
css: ['bootstrap/dist/css/bootstrap.css'],
115+
})
116+
```
117+
118+
Enjoy it in your app without import.
119+
120+
```vue
121+
<template>
122+
<div>
123+
<BButton variant="primary">Test</BButton>
124+
</div>
125+
</template>
126+
```
127+
83128
## Comparison with BoostrapVue
84129

85130
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`.

nuxt.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {defineNuxtModule} from '@nuxt/kit'
2+
import {fileURLToPath} from 'node:url'
3+
4+
export default defineNuxtModule({
5+
hooks: {
6+
'components:dirs'(dirs) {
7+
// Add ./components dir to the list
8+
dirs.push({
9+
path: fileURLToPath(new URL('./src/components', import.meta.url)),
10+
extensions: ['vue'],
11+
})
12+
},
13+
},
14+
})

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
"import": "./dist/bootstrap-vue-3.es.js",
1212
"require": "./dist/bootstrap-vue-3.umd.js"
1313
},
14-
"./dist/bootstrap-vue-3.css": "./dist/bootstrap-vue-3.css"
14+
"./dist/bootstrap-vue-3.css": "./dist/bootstrap-vue-3.css",
15+
"./nuxt": "./nuxt.js"
1516
},
1617
"files": [
1718
"dist",
18-
"src"
19+
"src",
20+
"nuxt.js"
1921
],
2022
"types": "./dist/BootstrapVue.d.ts",
2123
"workspaces": [

0 commit comments

Comments
 (0)