Can you please direct me to the location of the "Vue starting point"?

Currently, I am in the process of installing bootstrap-vue into my vue-cli project. I referred to the documentation provided at for guidance:

To begin, BootstrapVue needs to be registered in your app entry point:

import Vue from 'vue'
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'

// Installation of BootstrapVue
Vue.use(BootstrapVue)
// Optionally add the BootstrapVue icon components plugin
Vue.use(IconsPlugin)
Additionally, import the Bootstrap and BootstrapVue css files:

import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
Alternatively, you can opt to import the Bootstrap and BootstrapVue scss files within a custom SCSS file:

@import 'node_modules/bootstrap/scss/bootstrap';
@import 'node_modules/bootstrap-vue/src/index.scss';
Ensure that you import the custom.scss file in your app entry point:

import './custom.scss'
It is essential to @import or define your custom variable values prior to including Bootstrap SCSS (bootstrap.scss) and subsequently incorporate BootstrapVue SCSS (bootstrap-vue.scss) to guarantee correct setup of variables.

Compile all SCSS @imports into a single SCSS file and include this single file in your project. Failing to do so may result in variable values and functions not being shared across files by default.

Webpack and Parcel offer support for prepending the scss modules with tilde paths (~) when importing from an scss file:

// Sample Webpack import
@import '~bootstrap';
@import '~bootstrap-vue';
// Sample Parcel import
@import '~bootstrap/scss/bootstrap';
@import '~bootstrap-vue/src/index.scss';
For further details on configuring asset loading and resolving modules, kindly refer to the respective module bundlers' documentation.

I am uncertain about where to place all this. As a newcomer to vue.js, I am confused. Is the main.js the designated entry point? Should all this go there? The current state of my main.js is as follows:

import VueResource from 'vue-resource'
import VueRouter from 'vue-router'
import Routes from './routes'
import App from './App.vue'
import Vue from 'vue'
import './style/customColor.scss';
//import 'regenerator-runtime';

import store from "./store/store";
import { USER_ROLECHECK } from './store/actions/user'
import { REQ_ADMIN_ROLE } from "./utility/namespaces";
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'

Vue.use(VueResource);
Vue.use(VueRouter);
Vue.config.devtools = true; //this line should be removed in the actual live build!

const router = new VueRouter({
    routes: Routes,
    mode: 'history'
})

router.beforeEach((to, from, next) => {
  if(to.meta.reqAuth){
    if(store.getters.isAuthenticated){
      if(to.meta.reqAdmin){
        store.dispatch(USER_ROLECHECK, REQ_ADMIN_ROLE).then(() =>{
          next();
        }).catch(() =>{
          next({path: '/'})
        })
      }else{
        next();
      }
    }else{
      next({path: '/login'});
    }
  }else{
    next();
  }
})

new Vue({
  el: '#app',
   router,
   store,
  render: h => h(App),
})

What modifications are required here for the integration to function as intended?

Answer №1

Sure, when working with a vue-cli application, the key file to focus on is the main.js, which serves as the entry point for your app.

To set up your main.js properly, include the following code:

import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'

// Install BootstrapVue
Vue.use(BootstrapVue)
// Optionally install the BootstrapVue icon components plugin
// Only needed if you want to use the bootstrap icons. Be aware these are currently in alpha
Vue.use(IconsPlugin)


// Import Bootstrap and Bootstrap-Vue css
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

If utilizing SCSS, create a new file called styles.scss (the name can be anything), add the following lines:

@import 'node_modules/bootstrap/scss/bootstrap';
@import 'node_modules/bootstrap-vue/src/index.scss';

Then, import styles.scss into your main.js instead of the standard css files:

// Swap out these imports
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

// For this single line
import './path/to/your/styles.scss'

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Modifying state through inter-component communication in React.js

I need to implement a mechanism where the state of the main component can be updated from the "A" component, then passed to the "B" component for rendering and populating boxes dynamically. Main Component : constructor() { super(); this.s ...

Managing Express Sessions: Best Practices

I am currently working on handling authentication sessions in a Node.js, Express, Passport app. Despite using express-session and registering new users, the authentication still doesn't work. Below is the code snippet for the local strategy: // Loca ...

display the information stored within the sports attribute using React

I am attempting to display the values stored in the sports property. So, I inserted a console log within the sports property. However, an error is being thrown: Syntax error: C:/codebase/src/containers/sports.js: Unexpected token, expec ...

The background image fails to load in ReactJS application

Usually, I have no trouble finding solutions to my problems, but this time I'm really stuck - and I apologize in advance if my question seems silly or trivial. I am currently working on a simple React app where I need to set a background image for th ...

The act of exporting an enum from a user-defined TypeScript path leads to the error message "Module not

I have set up a custom path as explained in this particular discussion. "baseUrl": ".", "paths": { "@library/*": [ "./src/myFolder/*" ], } Within this module, I am exporting an Enum. export enum EN ...

Incorporating .txt files into a static webpage using only HTML and JavaScript

Exploring the realm of web page creation for the first time has left me in need of some guidance. I have successfully added an upload feature for text files on my web page, but I am struggling to embed a text file directly into the page source. With Java s ...

Exploring Techniques for Adjusting Website to User's Screen Resolution

My website is currently designed for a screen resolution of 1024x768. However, I am aware that when viewed on computers with smaller or larger screen resolutions, the layout starts to distort. Is there a way to make the website adaptable to any user&apos ...

Flickity Unable to Apply CSS Styles

Seems like a straightforward problem, it reminds me of this issue discussed on Stack Overflow but in relation to Vue instead of Angular. I am facing an issue where the CSS styling I'm trying to apply to my Flickity carousel is not being rendered corre ...

Choosing groupings of courses

I am looking to dynamically load divs with different combinations of classes from an external file using jQuery's load function, but I am struggling with grouping them correctly. $("#somediv").load("somefile.html .class1"); // loads all divs with c ...

What is the best way to retrieve the content of HTML tags from a string using JavaScript or AngularJS?

I have a string with mixed content of HTML tags and text. Here is an example: var str = "<p></p><p><i>blabla</i></p><p><i><b>blaaaaaablaaaaa</b></i></p><iframe src="..." height=" ...

Is the "add" feature malfunctioning?

My code is experiencing an issue where the URL and ID are not being passed correctly from one function to another. When I click on a link that contains the add() function, it fails to capture the URL and ID. <a href="#" style="color:#FFF;" onclick="add ...

Error: Angular2 RC5 | Router unable to find any matching routes

I am currently encountering an issue with my setup using Angular 2 - RC5 and router 3.0.0 RC1. Despite searching for a solution, I have not been able to find one that resolves the problem. Within my component structure, I have a "BasicContentComponent" whi ...

Building a TypeScript Rest API with efficient routing, controllers, and classes for seamless management

I have been working on transitioning a Node project to TypeScript using Express and CoreModel. In my original setup, the structure looked like this: to manage users accountRouter <- accountController <- User (Class) <- CoreModel (parent Class o ...

Angular app experiencing issues with material table row selection and hovering functionality not functioning as expected

I am working on a straightforward project that involves testing material row selection and hovering. The project is available on Stack Blitz at basic-table-test. I have a few questions regarding this: Why does the selection disappear when hovering the mou ...

When accessing WordPress through a URL, I am able to view regular PHP files but encounter difficulty accessing any uploaded files

Currently working on a Wordpress project and facing issues with creating a product via the WooCommerce REST API. I managed to make it work in my local environment, but upon uploading the files to the server, I am unable to reach a specific file via URL. Fo ...

Mastering the Art of Page Scrolling with d3

I would like to implement a scrolling effect for my d3 that allows the entire page to scroll while panning, similar to the effect on challonge (http://challonge.com/tournaments/bracket_generator?ref=OQS06q7I5u). However, I only want the scrolling to occur ...

Passing information from a parent component to a child component in Vue.js

Good evening. I am currently working on a chat application built with Laravel and Vue.js. I have successfully listed all the messages for my users, but now I want to make conversations selectable so that when a user clicks on a conversation, only the messa ...

The column must have a defined value and cannot be left empty

I encountered an issue while trying to populate a database with seed data. The error message I received is: name: 'SequelizeDatabaseError', parent: Error: Column 'id' cannot be null code: 'ER_BAD_NULL_ERROR', errno: 1048, sql ...

initial render results in undefined data

function Story() { let { id } = useParams(); const pin = useSelector(state => state.pins.pin); const dispatch = useDispatch(); const userid = 2 useEffect(() => { dispatch(getPin(id)); }, [dispatch, id]); return ( <div classN ...

Visualization of a two-variable function (Threejs)

Hey everyone! I'm looking to create custom graphics using JavaScript. Can anyone provide guidance on how to achieve this? I've been experimenting with Three.js, where I was able to create coordinate axes, but now I'm stuck on creating graphi ...