I'm having a difficult time understanding where/how to use Bootstrap in my nodejs project. I installed Bootstrap with npm, but how do I include it in my index.html file?
Do I need to include the stylesheet tag at the top and the tags above the tag at the bottom like usual in my .html files, or can I just start applying Bootstrap classes to my elements once I've required it in my app.js file?
Also, is there an advantage to using npm to install Bootstrap versus using the CDNs?
Add this code if using server like Express
app.use(
express.static(path.join(__dirname, "node_modules/bootstrap/dist/"))
);
Then in your head tag:
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With