Skip to content

Commit 4fc7ce3

Browse files
authored
docs: document cdnjs usage (#457)
Fixes #452.
1 parent eb6038d commit 4fc7ce3

File tree

2 files changed

+42
-26
lines changed

2 files changed

+42
-26
lines changed

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs
88

99
- **Complete** - Support for RFC4122 version 1, 3, 4, and 5 UUIDs
1010
- **Cross-platform** - Support for ...
11-
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and UMD builds
11+
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds (UMD)](#cdn-builds-umd)
1212
- Node 8, 10, 12, 14
1313
- Chrome, Safari, Firefox, Edge, IE 11 browsers
1414
- Webpack and rollup.js module bundlers
@@ -315,31 +315,39 @@ To run the examples you must first create a dist build of this library in the mo
315315
npm run build
316316
```
317317

318-
## UMD Builds
318+
## CDN Builds (UMD)
319319

320-
If you want to load a minified UMD build directly in the browser you can use one of the popular npm
321-
CDNs:
320+
This module may be loaded directly into a browser from any of the following CDNs:
321+
322+
**Using [UNPKG](https://unpkg.com/uuid@latest/dist/umd/)**:
322323

323324
```html
324325
<script src="https://unpkg.com/uuid@latest/dist/umd/uuidv4.min.js"></script>
325-
<script>
326-
alert(uuidv4());
327-
</script>
328326
```
329327

330-
or
328+
**Using [jsDelivr](https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/)**:
331329

332330
```html
333331
<script src="https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/uuidv4.min.js"></script>
332+
```
333+
334+
**Using [cdnjs](https://cdnjs.com/libraries/uuid)**:
335+
336+
```html
337+
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.1.0/uuidv4.min.js"></script>
338+
```
339+
340+
These CDNs all provide the same [`uuidv4()`](#version-4-random) method:
341+
342+
```html
334343
<script>
335-
alert(uuidv4());
344+
uuidv4(); // ⇨ '55af1e37-0734-46d8-b070-a1e42e4fc392'
336345
</script>
337346
```
338347

339-
Available bundles:
340-
341-
- https://unpkg.com/uuid@latest/dist/umd/
342-
- https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/
348+
Methods for the other algorithms ([`uuidv1()`](#version-1-timestamp),
349+
[`uuidv3()`](#version-3-namespace) and [`uuidv5()`](#version-5-namespace)) are available from the
350+
files `uuidv1.min.js`, `uuidv3.min.js` and `uuidv5.min.js` respectively.
343351

344352
## "getRandomValues() not supported"
345353

README_js.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs
2020

2121
- **Complete** - Support for RFC4122 version 1, 3, 4, and 5 UUIDs
2222
- **Cross-platform** - Support for ...
23-
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and UMD builds
23+
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds (UMD)](#cdn-builds-umd)
2424
- Node 8, 10, 12, 14
2525
- Chrome, Safari, Firefox, Edge, IE 11 browsers
2626
- Webpack and rollup.js module bundlers
@@ -304,31 +304,39 @@ To run the examples you must first create a dist build of this library in the mo
304304
npm run build
305305
```
306306

307-
## UMD Builds
307+
## CDN Builds (UMD)
308308

309-
If you want to load a minified UMD build directly in the browser you can use one of the popular npm
310-
CDNs:
309+
This module may be loaded directly into a browser from any of the following CDNs:
310+
311+
**Using [UNPKG](https://unpkg.com/uuid@latest/dist/umd/)**:
311312

312313
```html
313314
<script src="https://unpkg.com/uuid@latest/dist/umd/uuidv4.min.js"></script>
314-
<script>
315-
alert(uuidv4());
316-
</script>
317315
```
318316

319-
or
317+
**Using [jsDelivr](https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/)**:
320318

321319
```html
322320
<script src="https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/uuidv4.min.js"></script>
321+
```
322+
323+
**Using [cdnjs](https://cdnjs.com/libraries/uuid)**:
324+
325+
```html
326+
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.1.0/uuidv4.min.js"></script>
327+
```
328+
329+
These CDNs all provide the same [`uuidv4()`](#version-4-random) method:
330+
331+
```html
323332
<script>
324-
alert(uuidv4());
333+
uuidv4(); // ⇨ '55af1e37-0734-46d8-b070-a1e42e4fc392'
325334
</script>
326335
```
327336

328-
Available bundles:
329-
330-
- https://unpkg.com/uuid@latest/dist/umd/
331-
- https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/
337+
Methods for the other algorithms ([`uuidv1()`](#version-1-timestamp),
338+
[`uuidv3()`](#version-3-namespace) and [`uuidv5()`](#version-5-namespace)) are available from the
339+
files `uuidv1.min.js`, `uuidv3.min.js` and `uuidv5.min.js` respectively.
332340

333341
## "getRandomValues() not supported"
334342

0 commit comments

Comments
 (0)