How to import popper.js? How to import popper.js? javascript javascript

How to import popper.js?


I ran into the same problem.

I downloaded the 'popper.min.js' file from the CDN on the bootstrap website.

See here: https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js

Easier than compiling the project.

Important: You must include popper after jquery but BEFORE bootstrap.


The official way to install Popper.js is trough npm, Yarn or NuGet.

Use either one of the following commands :

npm i popper.jsyarn add popper.jsPM> Install-Package popper.js

Everything is described in the library readme.

Regarding the "downloads the zip", the zip clearly states that it contains the source code of the library.

Edit:

Starting from version 1.12.0, Popper.js is available as Bower dependency.

This installation method is going to be supported only for the 1.x version of Popper.js and will be removed in 2.x.

You should migrate your dependencies management to a modern system like npm or Yarn, as Bower suggests as well.


Ways to get popper.js: Package, CDN, and Local file

The best way depends on whether you have a project with a package manager like npm.

Package manager
If you're using a package manager, use it to get popper.js like this:

npm install popper.js --save

CDN
For a prototype or playground environment (like http://codepen.io) or may just want a url to a CDN file:

https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.5/umd/popper.jshttps://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.5/umd/popper.min.js

note: Bootstrap 4 requires the versions under the umd path (more info on popper/bs4).

Local file

Just save one of the CDN files to use locally. For example, paste one of these URLs in a browser, then Save As... to get a local copy.

https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.5/umd/popper.jshttps://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.5/umd/popper.min.js