'What Are the Steps to Move Content from GitHub to JsDelivr?

From what I can tell, the steps to move content from GitHub to JsDelivr are the following:

  1. Fork from https://github.com/jsdelivr/jsdelivr to https::/github.com/user/repo_name/, where user is your GitHub user name and repo_name is the name of your new repository.
  2. Clone the your GitHub repository to your local machine.
  3. Add your content to your local repository.
  4. Push your local repository to your GitHub repository.
  5. Add a version number to the commit you want to add to JsDeliver. (see Creating Releases)
  6. Send a pull request to https://github.com/jsdelivr/jsdelivr.

I realize this may be wrong and there is probably more than 1 way to do this, but I wanted to post a reasonable starting point for this discussion.



Solution 1:[1]

You don't need for fork anything. jsDelivr can pull files directly from Github. Just read the official documentation https://github.com/jsdelivr/jsdelivr#usage

Solution 2:[2]

Thanks in part to Jim's link, here's the skinny:

Have it on GitHub? It's on jDelivr already.

https://cdn.jsdelivr.net/gh/yourGitHubLogin/yourProjectName@latest/yourFileName.js

So, eg, here's an example based on an old project I haven't updated in forever:

If you want something other than latest (since, as they suggest, using latest on prod is always a bad idea), you need to add semver compliant git tags.

I haven't done that to my repo yet, but if you've added a tag named 1.0 to your repo, you'd just swap out the latest in the URL with that tag's text:

https://cdn.jsdelivr.net/gh/yourGitHubLogin/[email protected]/yourFileName.js


As a bonus, they'll even minify your file for you if you add .min to the name:

https://cdn.jsdelivr.net/gh/ruffin--/tagifyjs@latest/tagify.min.js

Though note that in my example the boilerplate their process adds is nearly as big as the file! (Only a slight exaggeration.) But if you have a decently sized file, you should be fine.

This is only a fallback, though. You can also include your own .min build files and it'll pick up on them instead of minimizing the "real" file.

/**
 * Minified by jsDelivr using Terser v5.10.0.
 * Original file: /gh/ruffin--/tagifyjs@master/tagify.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jim
Solution 2 ruffin