How to import popper.js?

后端 未结 11 2215
广开言路
广开言路 2020-12-25 10:12

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

I use bower and I\'ve installed B

相关标签:
11条回答
  • 2020-12-25 11:06

    It turns out that Popper.js doesn't provide compiled files on its GitHub repository. Therefore, one has to compile the project on his/her own or download compiled files from CDNs. It cannot be automatically imported.

    0 讨论(0)
  • 2020-12-25 11:08

    I had the same problem. Tried different approches, but this one worked for me. Read the instruction from http://getbootstrap.com/.

    Copy the CDN paths of Javascripts (Popper, jQuery and Bootstrap) in same manner (it is important) as given.

    <head>
    //Path to jQuery
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    
    ////Path to Popper - it is for dropsdowns etc in bootstrap
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
    
    //Path to bootsrap
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
    </head>

    0 讨论(0)
  • 2020-12-25 11:09

    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.

    0 讨论(0)
  • 2020-12-25 11:09

    I deleted any existing popper directories, then ran

    npm install --save popper.js angular-popper
    
    0 讨论(0)
  • 2020-12-25 11:10

    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.

    0 讨论(0)
提交回复
热议问题