Skip to content
Advertisement

How do I either: import all of the js files into html or figure out which js files I need to get collapse from bootstrap to work?

I installed bootstrap with npm and now I have a bunch of .js files but there is no “master” js file that I can import into html, unlike the css file that does have a master .css file.

I was unable to get the collapse to work without a cdn with

JavaScript

But It did work with:

JavaScript

This is my collapse menu:

JavaScript

I’d prefer not to use the cdn because I’m already using the node_modules from the css and sass. Am I missing scripts to import? Or is there a way to easily import all of the scripts without manually doing it?

Advertisement

Answer

I found the bootstrap.min.js file thanks to ISAE. I downloaded the bootstrap file here: https://www.npmjs.com/package/bootstrap#whats-included and went into bootstrap/dist/js/ which has all of the master bootstrap files.

You can also use npm install bootstrap and the pathway is very similar: node_modules/bootstrap/dist/js/

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement