You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+99-33Lines changed: 99 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,12 @@ Related projects:
7
7
8
8
**We are looking for contributors.** Please check open issues in the above repos if you think you could help, or open a new one if you have an idea you'd like to discuss.
9
9
10
-
### Note: Our backend changed. [Learn how to use the new jsDelivr](#usage)
11
-
12
10
jsDelivr is a free CDN for open source files. We are tightly integrated with Github and npm allowing us to automatically provide a reliable CDN service to almost every open source project out there.
13
11
14
12
We offer a stable CDN that can be used in production on popular websites with huge amounts of traffic.
15
13
There are no bandwidth limits or premium features and its completely free to use by anybody.
16
14
15
+
17
16
### [How does it work - A simple infographic](https://www.jsdelivr.com/network/infographic)
18
17
19
18
@@ -35,15 +34,15 @@ On top of that we also do version-fallback. This means that if a file used in ve
35
34
Multi-CDN
36
35
---------
37
36
38
-
Unlike the competition, jsDelivr uses multiple CDN providers, resulting in the best possible uptime and performance. We currently use [Stackpath][7], [CloudFlare][8], and [Fastly][14]. In mainland China we use [Quantil](https://www.quantil.com/).
37
+
Unlike the competition, jsDelivr uses multiple CDN providers, resulting in the best possible uptime and performance. We currently use [CloudFlare][8], and [Fastly][14]. In mainland China we use [Quantil](https://www.quantil.com/).
39
38
40
39
If a CDN goes down, websites that use jsDelivr won't have any issues because all traffic will be instantly redirected to remaining operational providers.
41
40
42
41
43
42
Smart Load Balancing
44
43
--------------------
45
44
46
-
jsDelivr uses real user performance data (also known as RUM) to make its routing decisions. These metrics are gathered from hundreds of websites and are used in our load balancing algorithm to make accurate decisions for serving content. Part of the logic is hosted close to users for optimal performance thanks to [edge hosting by appfleet](https://appfleet.com/)
45
+
jsDelivr uses real user performance data (also known as RUM) to make its routing decisions. These metrics are gathered from hundreds of websites and are used in our load balancing algorithm to make accurate decisions for serving content.
47
46
48
47
All providers (CDNs and custom servers) are tested millions times per day by real users from all over the world. Based on this information, jsDelivr knows what provider is the fastest for each user. Each user gets a unique response based on his or her location, ISP, and the providers' uptime in real time.
49
48
@@ -66,12 +65,6 @@ Our origin consits of multiple servers in different data-centers. If a server go
66
65
In total we have one of the most resilient systems out there, ready to be used in production by even the biggest companies.
67
66
68
67
69
-
HTTP2
70
-
-----------------
71
-
72
-
All of our POPs support HTTP2 offering better performance to all users.
73
-
74
-
75
68
China
76
69
----------------
77
70
@@ -82,62 +75,86 @@ jsDelivr works perfectly inside China!
82
75
83
76
# Usage
84
77
85
-
jsDelivr can instantly serve any file from any npm package in the public registry.
78
+
jsDelivr provides mirrors for npm, GitHub, WordPress plugins, and custom endpoints for several other projects with special requirements. If our regular endpoints don't work for your use case, [let us know](mailto:dak@prospectone.io) and we'll figure something out!
86
79
87
-
New versions pushed to npm are instantly available via our CDN as well. No maintenance is required.
80
+
If you are a package author, check our [tips for package authors](#Publishing-packages) to make using your package as easy as possible.
88
81
89
-
If a package, version or file gets removed from npm then jsDelivr will continue to serve that file from our permanent storage without breaking any websites using it.
82
+
#### Root endpoint is always `https://cdn.jsdelivr.net`
90
83
91
84
npm
92
85
---
86
+
jsDelivr can instantly serve any file from any npm package in the public registry.
87
+
New versions pushed to npm are instantly available via our CDN as well. No maintenance is required.
88
+
89
+
If a package, version or file gets removed from npm then jsDelivr will continue to serve that file from our permanent storage without breaking any websites using it.
90
+
91
+
We use a permanent S3 storage to ensure all files remain available even if npm goes down, or a package is deleted by its author. Files are fetched directly from npm only the first time, or when S3 goes down.
92
+
93
93
94
-
Load any project hosted on npm:
94
+
##### Load any project hosted on npm:
95
95
96
96
```
97
97
/npm/package@version/file
98
98
```
99
99
100
-
Load exact version:
100
+
##### Load exact version:
101
101
102
102
```
103
103
/npm/jquery@3.1.0/dist/jquery.min.js
104
104
```
105
105
106
-
Use a version range instead of an exact version:
106
+
##### Use a version range instead of an exact version:
107
107
108
108
```
109
109
/npm/jquery@3/dist/jquery.min.js
110
110
/npm/jquery@3.1/dist/jquery.min.js
111
111
```
112
+
---
113
+
**NOTE**
114
+
115
+
If you use this feature and a file you requested is not available in the newest version of the package, the link will keep working thanks to our version-fallback feature. We'll continue to serve the file from older version of the package instead of failing with a 404 error.
116
+
117
+
---
112
118
113
-
Load by tag: (Not recommended for production usage)
119
+
120
+
##### Load by tag (Not recommended for production usage):
114
121
115
122
```
116
123
/npm/jquery@beta/dist/jquery.min.js
117
124
```
118
125
119
-
Omit the version completely or use "latest" to load the latest one: (Dev environment only)
126
+
##### Omit the version completely or use "latest" to load the latest one (not recommended for production usage):
120
127
121
128
```
122
129
/npm/jquery@latest/dist/jquery.min.js
123
130
/npm/jquery/dist/jquery.min.js
124
131
```
132
+
---
133
+
**NOTE**
134
+
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.
125
135
126
-
Add ".min" to any JS/CSS file to get a minified version - if one doesn't exist, we'll generate it for you. All generated files come with source maps and can be easily used during development:
136
+
---
137
+
138
+
##### Add ".min" to any JS/CSS file to get a minified version - if one doesn't exist, we'll generate it for you. All generated files come with source maps and can be easily used during development:
Minifying a large file can take several seconds. However, we store all generated files in our permanent storage, so this delay only applies to the first few requests.
146
+
147
+
---
131
148
132
-
Omit the file path to get the [default file](#configuring-a-default-file-in-packagejson). This file is always minified:
149
+
##### Omit the file path to get the [default file](#configuring-a-default-file-in-packagejson). This file is always minified:
133
150
134
151
```
135
152
/npm/jquery@3.1.0
136
153
/npm/jquery@3
137
154
/npm/jquery
138
155
```
139
156
140
-
Get a directory listing:
157
+
##### Get a directory listing:
141
158
142
159
```
143
160
/npm/jquery@3.1.0/
@@ -146,41 +163,60 @@ Get a directory listing:
146
163
147
164
GitHub
148
165
------
166
+
We recommend using npm for projects that support it for better UX - npm packages are searchable on our website, and package pages show additional useful information, such as description and link to homepage.
167
+
168
+
We use a permanent S3 storage to ensure all files remain available even if GitHub goes down, or a repository or a release is deleted by its author. Files are fetched directly from GitHub only the first time, or when S3 goes down.
Use a version range instead of an exact version (only works with valid semver versions):
183
+
##### Use a version range instead of an exact version (only works with valid semver versions):
164
184
165
185
```
166
186
/gh/jquery/jquery@3/dist/jquery.min.js
167
187
/gh/jquery/jquery@3.1/dist/jquery.min.js
168
188
```
189
+
---
190
+
**NOTE**
191
+
If you use this feature and a file you requested is not available in the newest release, the link will keep working thanks to our version-fallback feature. We'll continue to serve the file from older release instead of failing with a 404 error.
169
192
170
-
Omit the version completely or use "latest" to load the latest one (only works with valid semver versions): (Dev environment only)
193
+
---
194
+
195
+
##### Omit the version completely or use "latest" to load the latest one (only works with valid semver versions): (Dev environment only)
171
196
172
197
```
173
198
/gh/jquery/jquery@latest/dist/jquery.min.js
174
199
/gh/jquery/jquery/dist/jquery.min.js
175
200
```
201
+
---
202
+
**NOTE**
203
+
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.
176
204
177
-
Add ".min" to any JS/CSS file to get a minified version - if one doesn't exist, we'll generate it for you. All generated files come with source maps and can be easily used during development:
205
+
---
206
+
207
+
208
+
##### Add ".min" to any JS/CSS file to get a minified version - if one doesn't exist, we'll generate it for you. All generated files come with source maps and can be easily used during development:
Minifying a large file can take several seconds. However, we store all generated files in our permanent storage, so this delay only applies to the first few requests.
182
216
183
-
Get a directory listing:
217
+
---
218
+
219
+
##### Get a directory listing:
184
220
185
221
```
186
222
/gh/jquery/jquery@3.1.0/
@@ -190,7 +226,7 @@ Get a directory listing:
190
226
Combine multiple files
191
227
----------------------
192
228
193
-
Our combine endpoint has the following format:
229
+
Our combine endpoint allows you to load several files from npm and GitHub endpoints in one request:
Combining large/many files can take several seconds. However, we store all generated files in our permanent storage, so this delay only applies to the first few requests.
246
+
247
+
---
207
248
208
249
Publishing packages
209
250
-------------------
@@ -224,6 +265,12 @@ All packages hosted on npm and tagged releases on GitHub are automatically avail
224
265
3.`main`
225
266
226
267
We will first attempt to locate a minified version of the file provided here (by removing the extension, and looking for the same file `.min.js`). If we can't find one we will minify ourselves.
268
+
269
+
Be advised that you must include file extension in the values, for example:
270
+
```
271
+
"main": "./index" // this will NOT work
272
+
"main": "./index.js" // this is the correct way
273
+
```
227
274
228
275
Restrictions
229
276
-------------------
@@ -233,24 +280,42 @@ Restrictions
233
280
WordPress
234
281
---------
235
282
236
-
Our WordPress endpoint works for plugins hosted in the [WordPress.org plugin directory](https://WordPress.org/plugins), and mirrors [the WordPress.org plugins SVN repo](https://plugins.svn.wordpress.org/) has the following format:
283
+
Our WordPress endpoint works for plugins and themes hosted in the [WordPress.org plugin directory](https://WordPress.org/plugins) and [Wordpress.org theme directory](https://wordpress.org/themes/), and mirrors [the WordPress.org plugins SVN repo](https://plugins.svn.wordpress.org/).
237
284
285
+
##### Load any plugin from the WordPress.org plugins SVN repo:
238
286
```
239
287
/wp/project/tags/version/file
240
288
```
241
289
242
-
Load exact version:
290
+
##### Load exact version:
243
291
244
292
```
245
293
/wp/wp-slimstat/tags/4.6.5/wp-slimstat.js
246
294
```
247
295
248
-
Load latest version: (Dev environment only)
296
+
##### Load latest version (not recommended for production usage):
249
297
250
298
```
251
299
/wp/wp-slimstat/trunk/wp-slimstat.js
252
300
```
253
301
302
+
##### Load any theme from the WordPress.org themes SVN repo:
##### Add ".min" to any JS/CSS file to get a minified version - if one doesn't exist, we'll generate it for you. All generated files come with source maps and can be easily used during development:
0 commit comments