bvite is carefully well thought UI frame work that is built on top of Bootstrap 5, This part of the doc will help you to quickly start your project and will you a basic idea about how bvite work.
bvite is a fully responsive and premium Bootstrap 5 Admin & Dashboard Template. Whether you're creating a Web App, Dashboards, Admin Panels, Project App, Analytics Admin, CRM, or SASS-based interface then you are at the right place to buy bvite admin dashboard template.
The official guide for how to include and bundle Bootstrap’s CSS and JavaScript in your project using Vite.
We’re building a Vite project with Bootstrap from scratch, so there are some prerequisites and up front steps before we can really get started. This guide requires you to have Node.js installed and some familiarity with the terminal.
Create a project folder and setup npm. We’ll create the my-project folder and initialize npm with the -y argument to avoid it asking us all the interactive questions.
Install Vite. Unlike our Webpack guide, there’s only a single build tool dependency here. We use --save-dev to signal that this dependency is only for development use and not for production.
npm i --save-dev vite
Install Bootstrap. Now we can install Bootstrap. We’ll also install Popper since our dropdowns, popovers, and tooltips depend on it for their positioning. If you don’t plan on using those components, you can omit Popper here.
npm i --save bootstrap @popperjs/core
Install additional dependency. In addition to Vite and Bootstrap, we need another dependency (Sass) to properly import and bundle Bootstrap’s CSS.
npm i --save-dev sass
We’ve already created the my-project folder and initialized npm. Now we’ll also create our src folder, stylesheet, and JavaScript file to round out the project structure. Run the following from my-project, or manually create the folder and file structure shown below.
mkdir {src,src/assets/js,src/assets/scss}
touch src/index.html src/assets/js/main.js src/assets/scss/styles.scss vite.config.js
npm
installs dependencies. )With dependencies installed and our project folder ready for us to start coding, we can now configure Vite and run our project locally.
Open vite.config.js
in your editor. Since it’s blank, we’ll need to add some boilerplate config to it so we can start our server. This part of the config tells Vite where to look for our project’s JavaScript and how the development server should behave (pulling from the src
folder with hot reload).
<script>
const path = require('path')
export default {
root: path.resolve(__dirname, 'src'),
build: {
outDir: '../dist'
},
server: {
port: 8080,
hot: true
}
}
</script>
Next we fill in src/index.html.
This is the HTML page Vite will load in the browser to utilize the bundled CSS and JS we’ll add to it in later steps.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap w/ Vite</title>
<script type="module" src="./js/main.js"></script>
</head>
<body>
<div class="container py-4 px-3 mx-auto">
<h1>Hello, Bootstrap and Vite!</h1>
<button class="btn btn-primary">Primary button</button>
</div>
</body>
</html>
We’re including a little bit of Bootstrap styling here with the div class="container"
and button
so that we see when Bootstrap’s CSS is loaded by Vite.
Now we need an npm script to run Vite. Open package.json
and add the start
script shown below (you should already have the test script). We’ll use this script to start our local Vite dev server.
{
// ...
"scripts": {
"start": "vite",
"test": "echo \"Error: no test specified\" && exit 1"
},
// ...
}
And finally, we can start Vite. From the my-project folder in your terminal, run that newly added npm script:
npm start
Import Bootstrap’s CSS. Add the following to src/scss/styles.scss to import all of Bootstrap’s source Sass
// Import all of Bootstrap's CSS
@import "bootstrap/scss/bootstrap";
Next we load the CSS and import Bootstrap’s JavaScript. Add the following to src/js/main.js to load the CSS and import all of Bootstrap’s JS. Popper will be imported automatically through Bootstrap.
// Import our custom CSS
import '../scss/styles.scss'
// Import all of Bootstrap's JS
import * as bootstrap from 'bootstrap'
Theme color scss file path: bvite/src/assets/global/_themes.scss
you can change as per your project/client requirements.
Theme light/dark version you can changes in HTML tage data-bs-theme="light"
, data-bs-theme="dark"
// Theme color variable
[data-bvite="theme-ValenciaRed"] {
--primary-color: #D63B38;
--accent-color: #8467cb;
--primary-rgb: 214, 59, 56;
--accent-rgb: 132, 103, 203;
--theme-color1: #da3164;
--theme-color2: #ce3c8d;
--theme-color3: #b152b1;
--theme-color4: #8467cb;
--theme-color5: #9aa9e0;
--theme-color6: #314674;
--primary-gradient: linear-gradient(-45deg, var(--primary-color), var(--secondary-color));
}
[data-bvite="theme-SunOrange"] {
--primary-color: #F7A614;
--accent-color: #006b60;
--primary-rgb: 247, 166, 20;
--accent-rgb: 0, 107, 96;
--theme-color1: #F7A614;
--theme-color2: #c25450;
--theme-color3: #ff8982;
--theme-color4: #9e7c50;
--theme-color5: #ffc0b7;
--theme-color6: #2f4858;
--primary-gradient: linear-gradient(-45deg, var(--primary-color), var(--secondary-color));
}
[data-bvite="theme-AppleGreen"] {
--primary-color: #5BC43A;
--accent-color: #006b5f;
--primary-rgb: 91, 196, 58;
--accent-rgb: 0, 107, 95;
--theme-color1: #00b864;
--theme-color2: #0097aa;
--theme-color3: #0084bd;
--theme-color4: #004e72;
--theme-color5: #96b0b7;
--theme-color6: #2f4858;
--primary-gradient: linear-gradient(-45deg, var(--primary-color), var(--secondary-color));
}
[data-bvite="theme-CeruleanBlue"] {
--primary-color: #00B8D6;
--accent-color: #00a686;
--primary-rgb: 0, 184, 214;
--accent-rgb: 0, 166, 134;
--theme-color1: #00b8d6;
--theme-color2: #8966a4;
--theme-color3: #bf9adb;
--theme-color4: #b2a8b8;
--theme-color5: #96b0b7;
--theme-color6: #00a686;
--primary-gradient: linear-gradient(-45deg, var(--primary-color), var(--secondary-color));
}
[data-bvite="theme-Mariner"] {
--primary-color: #0066FE;
--accent-color: #DEAD00;
--primary-rgb: 0, 102, 254;
--accent-rgb: 222, 173, 0;
--theme-color1: #2561BE;
--theme-color2: #d3a518;
--theme-color3: #f26a7f;
--theme-color4: #002878;
--theme-color5: #858fbb;
--theme-color6: #5b9591;
--primary-gradient: linear-gradient(-45deg, var(--primary-color), var(--secondary-color));
}
[data-bvite="theme-PurpleHeart"] {
--primary-color: #4C3575;
--accent-color: #e05170;
--primary-rgb: 76, 53, 117;
--accent-rgb: 224, 81, 112;
--theme-color1: #4C3575;
--theme-color2: #354175;
--theme-color3: #98427e;
--theme-color4: #d55a75;
--theme-color5: #fb8665;
--theme-color6: #d19a8b;
--primary-gradient: linear-gradient(145deg, var(--primary-color), var(--accent-color));
.page-header .header-right>li > a,
.page-header .header-right>li > div > a{
color: var(--white-color) !important;
}
}
[data-bvite="theme-FrenchRose"] {
--primary-color: #EB5393;
--accent-color: #4d74c9;
--primary-rgb: 235, 83, 147;
--accent-rgb: 77, 116, 201;
--theme-color1: #c82f75;
--theme-color2: #4d74c9;
--theme-color3: #5bbab5;
--theme-color4: #b861c2;
--theme-color5: #ddd7c6;
--theme-color6: #765a76;
--primary-gradient: linear-gradient(-45deg, var(--primary-color), var(--secondary-color));
}
All the important stuff – compiling the source, file structure, build tools, file includes – is documented here, but should you have any questions, always feel free to reach out to pixelwibes@gmail.com
If you really like our work, design, performance and support then please don't forgot to rate us on Themeforest, it really motivate us to provide something better.