Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The js / css resources are not read from local drive but from cdn with cdn_resources="local" #228

Open
fohrloop opened this issue May 3, 2023 · 2 comments

Comments

@fohrloop
Copy link

fohrloop commented May 3, 2023

Using pyvis 0.3.2

Steps to reproduce:

# script.py
from pyvis.network import Network
nt = Network(
    cdn_resources="local",
)
nt.show('network.html', notebook=False)

The output draws content from

niko@niko-ubuntu:~/tmp/pyvis_tests$ cat network.html | grep 'href=\"http\|src=\"http' -C 5
<html>
    <head>
        <meta charset="utf-8">
        
            <script src="lib/bindings/utils.js"></script>
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/dist/vis-network.min.css" integrity_no="sha512-WgxfT5LWjfszlPHXRmBWHkV2eceiWTOBvrKCNbdgDYTHrT2AeLCGbF4sZlZw3UMN3WtL0tGUoIAKsu8mllg/XA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
            <script src="https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js" integrity_no="sha512-LnvoEWDFrqGHlHmDD2101OrLcbsfkrzoSpvtSQtxK3RMnRV0eOkhhBN2dXHKRrUU8p2DGRTk35n4O8nWSVe1mQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
            
        
<center>
<h1></h1>
</center>

<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
        <link
          href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
          rel="stylesheet"
          integrity_no="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
          crossorigin="anonymous"
        />
        <script
          src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
          integrity_no="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
          crossorigin="anonymous"
        ></script>

Notes

Note that it pyvis actually copies these files under lib:

niko@niko-ubuntu:~/tmp/pyvis_tests$ python -m seedir 
pyvis_tests/
├─network.html
├─script.py
└─lib/
  ├─vis-9.1.2/
  │ ├─vis-network.min.js
  │ └─vis-network.css
  ├─bindings/
  │ └─utils.js
  └─tom-select/
    ├─tom-select.complete.min.js
    └─tom-select.css

The files are:

  • vis-network.min.js -- copied, but the HTML reads it from CDN
  • vis-network.css -- copied, but the HTML reads it from CDN
  • utils.js -- correct
  • tom-select.complete.min.js -- copied, but is it used?
  • tom-select.css -- copied, but is it used?
  • bootstrap.min.css -- missing! read from CDN.
  • bootstrap.bundle.min.js -- missing! read from CDN.
@fohrloop
Copy link
Author

fohrloop commented May 3, 2023

Related PR: #201

@fohrloop
Copy link
Author

fohrloop commented May 3, 2023

Currently the output does not work without an internet connection. The browser debug tools show this:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant