GitHub+jsDelivr 打造免费且速度理想的 OSS

29
2020/01

GitHub+jsDelivr 打造免费且速度理想的 OSS

jsDelivr 提供免费的开源 CDN 服务，支持加速来自 npm、GitHub 以及 WordPress 的资源。

// load any GitHub release, commit, or branch

// note: we recommend using npm for projects that support it

https://cdn.jsdelivr.net/gh/user/[email protected]/file

https://cdn.jsdelivr.net/gh/jquery/[email protected]/dist/jquery.min.js

// use a version range instead of a specific version

https://cdn.jsdelivr.net/gh/jquery/[email protected]/dist/jquery.min.js

https://cdn.jsdelivr.net/gh/jquery/[email protected]/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/[email protected]/src/core.min.js

// add / at the end to get a directory listing

https://cdn.jsdelivr.net/gh/jquery/jquery/

Update on 2020-01-31：经更加细致考证，删去之前的主观臆断内容，并补充如下。

Omit the version completely or use "latest" to load the latest one (not recommended for production usage)

Requesting the latest version (as opposed to "latest major" or "latest minor") is dangerous because major versions usually come with breaking changes. Only do this if you really know what you are doing.

jsDelivr 还提供一些别的小功能，比如：

1. 可以上传视频么