Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import popper.js?

It seems to be a lame question, but I cannot figure it out. How to import popper.js which comes together with Bootstrap 4 beta?

I use Bower, and I've installed Bootstrap 4 beta. Now in the bower_components folder, there is the popper.js directory, which contains a few sub-folders. The problem is there is no dist folder and the popper.min.js file.

Bootstrap 4 guide links to CDN: https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js.

How to import popper.js without CDN? Where to find the popper.min.js file?

EDIT: Even if I download a zip file from the popper.js website, it contains the same files as I've downloaded from Bower.

like image 533
Qrzysio Avatar asked Aug 12 '17 13:08

Qrzysio


People also ask

How do I get a popper js file?

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. note: Bootstrap 4 requires the versions under the umd path (more info on popper/bs4).

What is Popper js library?

A library used to manage poppers in web applications. Popper. js is a positioning engine, its purpose is to calculate the position of an element to make it possible to position it near a given reference element.


Video Answer


2 Answers

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.

like image 82
Sora Avatar answered Sep 30 '22 04:09

Sora


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

Use either one of the following commands :

npm i popper.js yarn add popper.js PM> 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.

like image 25
Fez Vrasta Avatar answered Sep 30 '22 02:09

Fez Vrasta