0

I'm using jsdelivr to point to a javascript file I'm working on in Git. I have done a fair amount of research, mostly by following these instructions:

Link and execute external JavaScript file hosted on GitHub

I cannot figure out a way to have a master link to my file that updates as I commit edits. I can't use a commit hash, because that changes every time. I just want the URL to my javascript file to always reflect the latest commit and I cannot figure it out.

4
  • 1
    This has nothing to do with Git. You want to deploy your source code somewhere which Git is, frankly, unconcerned with. Commented Dec 13, 2018 at 19:45
  • Actually, it does. I use jsdelivr to host the link directly. I want to be able to edit the code, commit, then have that code functioning on my other site live. I figured git was the best way to do this. Commented Dec 13, 2018 at 19:49
  • The question you link to suggests GitHub does not want you to do this. It's probably a significant additional load on their servers that they don't really want to see. Commented Dec 13, 2018 at 20:25
  • 1
    Ugh...... jsDelivr handles this perfectly fine. That's what it's for. Please read the post more carefully. Commented Dec 13, 2018 at 21:17

2 Answers 2

1

jsDelivr will provide a CDN mirror of a Github repository. If you want to see your commits on jsDelivr it's necessary to get your commits onto Github. Because Git is decentralized git commit only commits to your local repository. You then need to git push your changes to Github. Then jsDelivr can sync with Github.

See Working With Remotes in the Git Book and Managing Remotes on Github for more information.

Sign up to request clarification or add additional context in comments.

2 Comments

How do I do this in a browser?
@PatrickHennessey You do it wherever you're editing the files and making the commits. You normally don't do that in the browser, unless you're editing files directly on Github.
0

Here's the solution I'm looking for: codepen.io.

Codepen lets you work on a JS file in-browser and in a sandbox, then use a direct link to that file that another site can use. This is perfect for me, because the site I need to embed the JS in isn't serving millions of visitors.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.