Bootstrap 4: how to use NavBars without jQuery / minimal bootstrap.js?

Viewed 2383

The vast majority of pages on our site will only use GRID and NAVBAR. It makes no sense for us to be loading all of jQuery and bootstrap.min.js on each page.

In fact, the only JS needed at all is the js to handle the opening/closing of NAVBAR on mobile requests.

Has anyone created a minimal, small .js that handles this?

I found a bunch for Bootstrap 3, but nothing that I can see for Bootstrap 4.

Thanks

2 Answers

Yes! you can use this:

https://thednp.github.io/bootstrap.native/v4.html

With cdn

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bootstrap.native@2.0.15/dist/bootstrap-native-v4.min.js"></script>

With npm

Run command:

npm install https://github.com/thednp/bootstrap.native

And import:

var bsn = require('bootstrap.native/dist/bootstrap-native-v4');
Related