免费CDN加速服务 jsDelivr 支持npm,GitHub,WordPress
免费CDN加速服务 jsDelivr 支持npm,GitHub,WordPress
- CDN介绍
- 免费CDN - jsDelivr
- jsDelivr+GitHub 使用方法
- 合并多个文件
- jsDelivr+npm 使用方法
- jsDelivr+WordPress 使用方法
CDN介绍
内容分发网络(英语:Content Delivery Network或Content Distribution Network,缩写:CDN)是指一种透过互联网互相连接的电脑网络系统,利用最靠近每位用户的服务器,更快、更可靠地将音乐、图片、视频、应用程序及其他文件发送给用户,来提供高性能、可扩展性及低成本的网络内容传递给用户。
通俗来讲,能加速访问静态资源的速度,项目中分离静态资源能减轻对服务器的负载。
免费CDN - jsDelivr
访问地址: jsDelivr
jsDelivr提供npm,GitHub,WordPress等项目的镜像。
jsDelivr+GitHub 使用方法
官网上给的示例
// load any GitHub release, commit, or branch
// note: we recommend using npm for projects that support it
https://cdn.jsdelivr.net/gh/user/repo@version/file// load jQuery v3.2.1
https://cdn.jsdelivr.net/gh/jquery/jquery@3.2.1/dist/jquery.min.j// 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/
具体步骤
- 创建github账户,以及在github上创建repository步骤可自行百度
- 访问repository中文件,可以参照示例进行修改
// https://cdn.jsdelivr.net/gh/github用户名/repository名称@版本号或分支/file文件名
https://cdn.jsdelivr.net/gh/user/repo@version/file
以jQuery的github repository为例,地址为:https://github.com/jquery/jquery
若访问Releases中3.4.1版本,那github中会有这样的文件
// 访问jQuery Releases中3.4.1版本的目录结构
https://cdn.jsdelivr.net/gh/jquery/jquery@3.4.1/
// 访问jQuery最新版本的目录结构(去掉@版本号)
https://cdn.jsdelivr.net/gh/jquery/jquery/
也可以直接访问github repository分支下的文件,在生产环境中不推荐使用。
// 访问jQuery repository分支下的目录结构(main分支)
https://cdn.jsdelivr.net/gh/jquery/jquery@main/
// 访问jQuery repository分支下的目录结构(1.12-stable分支)
https://cdn.jsdelivr.net/gh/jquery/jquery@1.12-stable/
合并多个文件
jsdelivr的组合端点允许您在一个请求中从npm和GitHub端点加载多个文件:
https://cdn.jsdelivr.net/combine/url1,url2,url3
适用于单个文件的所有功能(版本范围,缩小等)也适用于此处。所有组合文件都带有源映射,可以在开发过程中轻松使用。
例如:
https://cdn.jsdelivr.net/combine/gh/jquery/jquery@3.2/dist/jquery.min.js,gh/twbs/bootstrap@3.3/dist/js/bootstrap.min.js
https://cdn.jsdelivr.net/combine/npm/bootstrap@3.3/dist/css/bootstrap.min.css,npm/bootstrap@3.3/dist/css/bootstrap-theme.min.css
jsDelivr+npm 使用方法
// load any project hosted on npm
https://cdn.jsdelivr.net/npm/package@version/file// load jQuery v3.2.1
https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js// use a version range instead of a specific version
https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js
https://cdn.jsdelivr.net/npm/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/npm/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/npm/jquery@3.2.1/src/core.min.js// omit the file path to get the default fil
https://cdn.jsdelivr.net/npm/jquery@3.2// add / at the end to get a directory listing
https://cdn.jsdelivr.net/npm/jquery/
jsDelivr+WordPress 使用方法
// load any plugin from the WordPress.org plugins SVN repo
https://cdn.jsdelivr.net/wp/plugins/project/tags/version/file// load an exact version
https://cdn.jsdelivr.net/wp/plugins/wp-slimstat/tags/4.6.5/wp-slimstat.js// load the latest version
// you should NOT use this in production
https://cdn.jsdelivr.net/wp/plugins/wp-slimstat/trunk/wp-slimstat.js// load any theme from the WordPress.org themes SVN repo
https://cdn.jsdelivr.net/wp/themes/project/version/file// load an exact version
https://cdn.jsdelivr.net/wp/themes/twenty-eightteen/1.7/assets/js/html5.js
免费CDN加速服务 jsDelivr 支持npm,GitHub,WordPress相关推荐
- 十大免费CDN加速服务排行榜-国内外免费CDN服务总结
CDN全称Content delivery network,中文内容分发网络,目的是通过在现有的Internet中增加一层新的网络架构,将网站的内容发布到最接近用户的网络"边缘", ...
- 免费CDN加速:jsDelivr+Github
原文:https://nuyoah-xlh.github.io/2021/08/15/%E5%85%8D%E8%B4%B9CDN%E5%8A%A0%E9%80%9F%EF%BC%9AjsDelivr+ ...
- 利用Github+jsDelivr搭建自己的免费CDN加速
利用Github+jsDelivr搭建自己的免费CDN加速 一.CDN百度百科: CDN的全称是Content Delivery Network,即内容分发网络.CDN是构建在现有网络基础之上的智 ...
- 【官方】BootCDN-稳定、快速、免费的前端开源项目 CDN 加速服务
关于 BootCDN BootCDN 是 极兔云 联合 Bootstrap 中文网 共同支持并维护的前端开源项目免费 CDN 服务,致力于为 Bootstrap.jQuery.React.Vue.js ...
- 免费CDN加速 jQuery、Bootstrap、Vue、React 等JS库
BootJS 提供同支持并维护的前端开源项目免费 CDN 服务,致力于为 Bootstrap.jQuery.React.Vue.js 一样优秀的前端开源项目提供稳定.快速的免费 CDN 加速服务.Bo ...
- 分享几个CDN加速服务
总结一下国内外几个好不错的CDN网站加速服务.可能会有一些熟知的在里面. Incapsula CDN网站加速服务.Incapsula是美国一家专门提供CDN服务的网站,虽不是最早提供CDN服务的商家, ...
- 如何使用jsDelivr+Github 实现免费CDN加速?
序言 个人采用hexo搭建了博客,博客也刚上线不久,博客地址:https://www.xiezhrspace.cn . 欢迎小伙伴访问,疯狂暗示来关注来访问(‐^▽^‐). 虽然放到了云服务器上,但是 ...
- 奇安信cdn配置教程_PicGo+jsDelivr+GitHub搭建免费cdn加速的图床
PicGo+jsDelivr+GitHub搭建免费cdn加速图床.下面是我写的教程. https://www.sakura521.cn/2020/03/13/picgocdn.htmlwww.sak ...
- axios 注册拦截器 cdn引用_PicGo+jsDelivr+GitHub搭建免费cdn加速的图床
PicGo+jsDelivr+GitHub搭建免费cdn加速图床.下面是我写的教程. https://www.sakura521.cn/2020/03/13/picgocdn.htmlwww.sak ...
最新文章
- java29:Map
- 怎样检查Android网络连接状态
- 关于Java函数传参以及参数在函数内部改变的问题——JAVA值传递与引用最浅显的说明!...
- 配置Maven使用Nexus
- linux7yum安装mysql,CentOS7 使用yum安装mysql
- strcmp() Anyone? UVA - 11732 左孩子右兄弟Trie/计数
- amd64_or_ia64?
- 怎样看pytorch源码最有效?
- 80x86汇编小站-公告
- Xshell使用教程
- iTOP-4418开发板Android7.1系统支持RFID、VGA、继电器、LOAR、CAN-RS485
- 怎样获得python证书_如何从python中的x509证书中提取公钥?
- 4g硬盘可以装Linux 么,eeepc 900a 4g ssd硬盘予装了linux操作系统是否能改装xp
- 广东移动 - 无线应用加速业务系统
- 电脑开机密码忘记了怎么办
- 化整为零 盛大在换轨
- free与 available 之间区别
- 【开篇】STM32F103C8T6 含义、命名规则、GPIO原理以及初始化(参考男神江科协,学习交流用)
- PyCharm激活时遇到This license K71U8DBPNE has been cancelled的解决办法
- RabbitMQ消费失败重试策略、及重试策略应用场景详解
热门文章
- 地平线黎明时分dlc评测_我从第一个玩法中学到的地平线零黎明的提示
- 基于Java毕业设计校园外卖系统Web端源码+系统+mysql+lw文档+部署软件
- 2020iPadAir(第四代)对比iPadPro(第二代)
- 大数据方面的核心技术
- 2021-2027全球与中国可持续性蛋白质市场现状及未来发展趋势
- 谈谈企业的持续交付流水线设计
- 血栓清道夫机器人_这几种食物是血管“清道夫”,每天吃一点,清除血管垃圾,防血栓...
- 使用Java计算生辰八字五行属性
- c30-程序中的三国天下(c31-程序中的内存布局)
- 解决海康威视摄像头无法通过路由器远程访问的问题