Important! This guide is out of date (circa 2017) and should no longer be used. For the latest advice, please refer to the BootstrapVue docs and their Nuxt.js module. https://bootstrap-vue.org/docs#nuxt-js
General setup:
-
Install bootstrap as a dev dependency, and its dependencies (node-sass and sass-loader)
npm install --save-dev [email protected] node-sass sass-loader
-
Install nuxt plugin of bootstrap vue (includes bootstrap-vue as a dependency)
npm install @nuxtjs/bootstrap-vue
-
Register plugin as module in nuxt.config.js (see below)
-
Create app.scss entry point (see below)
-
Add app.scss entry point file to
css
setting in nuxt.config.js (see below) -
Configure postcss:
- Create a postcss.config.js file next to package.json (repo root) (see below)
- Update package.json with supported browsers list as per what bootstrap or yourself use (see below)
- Install those plugins for dev build:
npm install --save-dev precss autoprefixer
Optimizations:
- Use app2.scss to only import css you need.
- Don't use module registration/plugin installer, simply call Vue.component/Vue.directive on things you want, or even just load per component in your own components as needed with import.
Hi, Can you give me some example for your last mention that
I want to use bootstrap components per file not globally.
option 2 is still load all components what I selected however, some vue component doesn't need everything...