skinnybrit51 skinnybrit51 - 1 year ago 147
jQuery Question

How do I load bootstrap using npm?

I have a npm project that uses jquery.

var $ = require('jquery');

I also have an index html file that references bootstrap.

<link href="//" rel="stylesheet"/>

<script type="text/javascript" src="my-script.js"></script>
<script src="//"></script>

<script src="//"></script>

Now do I need to a separate load for jquery for bootstrap as it depends on it? I was recently using
instead of
and I did not need the separate load.

Can anyone recommend a loading pattern for bootstrap with use with require?

Answer Source

Bootstrap is now a supported node package by the bootstrap guys.

What this means is you can now require bootstrap in code. So.

npm install bootstrap --save

npm install jquery --save


var $ = require('jquery');
window.$ = $;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download