admin管理员组

文章数量:1291172

I have a js file stored here in GitHub.

    // Define the function before setup() i.e. at the top if defining in same js file
    // Call the function under draw()
    function pointCoord() {
      stroke(255,0,0);
      line(mouseX,0, mouseX, height);
      line(0,mouseY, width, mouseY);
      if (mouseIsPressed){console.log(`x = ${mouseX}, y = ${mouseY}`);}
      }

This is its jsdelivr link: @main/Tools/x-y-coordinate%20pointer.js

// Define the function before setup() i.e. at the top if defining in same js file
// Call the function under draw()
function pointCoord() {
  stroke(255,0,0);
  line(mouseX,0, mouseX, height);
  line(0,mouseY, width, mouseY);
  if (mouseIsPressed){print("x = "+ mouseX+ ", y = "+mouseY);}
  }

(If you are curious this doesn't look like Vanilla JS code..this file is meant to be used under the p5.js library)

As you would see, the last line on both pages is different. Actually, the jsdelivr page doesn't show the content updated with the previous 2 mits on GitHub - and it's over 10 hours since I have mitted them.

Now how do I update the code in jsdelivr CDN?

I have a js file stored here in GitHub.

    // Define the function before setup() i.e. at the top if defining in same js file
    // Call the function under draw()
    function pointCoord() {
      stroke(255,0,0);
      line(mouseX,0, mouseX, height);
      line(0,mouseY, width, mouseY);
      if (mouseIsPressed){console.log(`x = ${mouseX}, y = ${mouseY}`);}
      }

This is its jsdelivr link: https://cdn.jsdelivr/gh/JaPatGitHub/EduSimulations@main/Tools/x-y-coordinate%20pointer.js

// Define the function before setup() i.e. at the top if defining in same js file
// Call the function under draw()
function pointCoord() {
  stroke(255,0,0);
  line(mouseX,0, mouseX, height);
  line(0,mouseY, width, mouseY);
  if (mouseIsPressed){print("x = "+ mouseX+ ", y = "+mouseY);}
  }

(If you are curious this doesn't look like Vanilla JS code..this file is meant to be used under the p5.js library)

As you would see, the last line on both pages is different. Actually, the jsdelivr page doesn't show the content updated with the previous 2 mits on GitHub - and it's over 10 hours since I have mitted them.

Now how do I update the code in jsdelivr CDN?

Share Improve this question edited Aug 27, 2021 at 13:44 Jyotiraditya Pradhan asked Aug 27, 2021 at 13:35 Jyotiraditya PradhanJyotiraditya Pradhan 531 silver badge5 bronze badges 1
  • 1 Pretty in-depth answer to this question in a jsdelivr issue opened on Github: "If you use a @main reference the releases are not relevant at all and it follows the branch caching behavior. If you used @latest the release caching behavior would apply (note that it's "up to 7", not "strictly 7" in that case)" and @latest currently takes up to 12 hours. – ruffin Commented Nov 8, 2023 at 20:42
Add a ment  | 

2 Answers 2

Reset to default 6

You can use the following link to retrieve the latest version of your code from jsDelivr: https://cdn.jsdelivr/gh/JaPatGitHub/EduSimulations@latest/Tools/x-y-coordinate%20pointer.js

By using @latest in the link, you're instructing jsDelivr to serve the most recent version available in the repository, regardless of the branch name.

From jsDelivr's website regarding GitHub CDN

We use a permanent S3 storage to ensure all files remain available even if GitHub goes down, or a repository or a release is deleted by its author. Files are fetched directly from GitHub only the first time, or when S3 goes down.

Use a release (or some other named) branch and then access that branch from jsDelivr.

本文标签: javascriptjsdelivr doesn39t update github commitsStack Overflow