Reputation: 79
I have Bootstrap working properly in my Vue project. I would like to use a theme from Bootswatch. In my Vue project, I replaced the node_modules/bootstrap/dist/bootstrap.min.css file with one that I downloaded from the Bootswatch site. But the new theme didn't change anything. Note: In my main.js I have the following:
import 'bootstrap'
How do I properly get the new theme to work?
Upvotes: 1
Views: 3718
Reputation: 1
if you want to use npm...
npm install bootstrap bootswatch jquery popper.js
Then add this lines to your entry point file main.js:
import "bootstrap";
import "../node_modules/bootswatch/dist/theme/bootstrap.min.css";
import "jquery";
import "popper.js"
replace theme with your theme (journal,lux...)
Upvotes: 0
Reputation: 31
yarn add bootstrap bootswatch jquery popper.js
main.js
:
import "bootstrap";
import "../node_modules/bootswatch/dist/lux/bootstrap.min.css";
import "jquery";
import "popper.js";
lux
is a theme name, so you can replace it with a theme of your choice. 😎
Upvotes: 3
Reputation: 31352
You should import the css file in main.js as follows
import '../node_modules/bootstrap/dist/bootstrap.min.css'
Make sure you have configured your webpack to use css-loader
or
In your root component(mostly App.vue) add two style tags , one for global styles and other for scoped styles if you have any with the scoped attribute.See src imports.
<style src='path/to/node_modules/bootstrap/dist/bootstrap.min.css'>
/* global styles */
</style>
<style scoped>
/* local styles */
</style>
Upvotes: 2
Reputation: 178
Try clearing your browser cache and restarting whatever vue is running on
Upvotes: 1