0
点赞
收藏
分享

微信扫一扫

使用jsDelivr和GitHub,上传本地静态资源到免费CDN

罗子僧 2023-05-19 阅读 72

目标:将本地图片资源上传到免费CDN,以便随时使用!其他静态资源亦可,例如:js、css、pdf、word、excel 等等

  • 可以在 github 使用 Upload files 上传文件:

  • 也可以先将仓库克隆到本地:

git clone git@github.com:themusecatcher/resources.git

进入本地仓库:

cd resources/

将需要上传的图片复制到 resources/ 目录中,然后 push 到远程仓库:

git add .
git commit -m 'upload'
git push

新建一个 tag 例如:0.0.3 

然后即可使用如下规则访问 CDN 资源:

https://cdn.jsdelivr.net/gh/<username>/<repo name>@<tag>/<resource name>

例如:https://cdn.jsdelivr.net/gh/themusecatcher/resources@0.0.3/bao.jpg

⑥查看 CDN 资源目录:

https://cdn.jsdelivr.net/gh/themusecatcher/resources@0.0.3/

举报

相关推荐

0 条评论