github搭建CDN
github搭建CDN
原文:https://baijiahao.baidu.com/s?id=1623013726378332873&wfr=spider&for=pc
新建公开的github仓库,命明为CDN。接着在本地电脑克隆上图仓库。
1
git clone https://github.com/wangyangyangisme/CDN.git
复制需要的静态资源到本地CDN仓库中,提交到github仓库上。
1
2
3git add .
git commit -m "update"
git push注:jsDeliver不支持加载超过20M的资源,所以一些视频最好压缩到20M以下
点击release发布,发布版本号为1.0(自定义),不发布直接写latest
使用方法
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21// load any GitHub release, commit, or branch
// note: we recommend using npm for projects that support it
https://cdn.jsdelivr.net/gh/用户名/仓库名@发布的版本号/文件路径
// load jQuery v3.2.1
https://cdn.jsdelivr.net/gh/jquery/jquery@3.2.1/dist/jquery.min.js
// use a version range instead of a specific version
https://cdn.jsdelivr.net/gh/jquery/jquery@3.2/dist/jquery.min.js
https://cdn.jsdelivr.net/gh/jquery/jquery@3/dist/jquery.min.js
// omit the version completely to get the latest one
// you should NOT use this in production
https://cdn.jsdelivr.net/gh/jquery/jquery/dist/jquery.min.js
// add ".min" to any JS/CSS file to get a minified version
// if one doesn't exist, we'll generate it for you
https://cdn.jsdelivr.net/gh/jquery/jquery@3.2.1/src/core.min.js
// add / at the end to get a directory listing
https://cdn.jsdelivr.net/gh/jquery/jquery/
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Blank!
评论