- Open the raw version of your file in Github and copy the url
url should look something like this
https://raw.githubusercontent.com/<user-name>/<repo-name>/<branch>/<path_to_file>/filename.js
- Replace
raw.githubusercontent.com
tocdn.jsdelivr.net
https://cdn.jsdelivr.net/<user-name>/<repo-name>/<branch>/<path_to_file>/filename.js
- Remove the branch name.
https://cdn.jsdelivr.net/<user-name>/<repo-name>/<path_to_file>/filename.js
- Insert
gh/
before your username.
https://cdn.jsdelivr.net/gh/<user-name>/gh/<repo-name>/<path_to_file>/filename.js
https://cdn.jsdelivr.net/gh/<user-name>/gh/<repo-name>@<commit_hash>/<path_to_file>/filename.js