Skip to content

Commit

Permalink
doc: updated readme for CDN usage (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
JinIgarashi authored Apr 16, 2024
1 parent 77e89a6 commit 2eacdf0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 29 deletions.
30 changes: 16 additions & 14 deletions packages/mapbox-gl-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,25 @@ npm i @watergis/mapbox-gl-export --save

## Use CDN

import JS and CSS from CDN.

- from unpkg.com

```html
<link href="https://www.unpkg.com/@watergis/mapbox-gl-export@latest/dist/mapbox-gl-export.css" rel="stylesheet" />
<script src='https://api.mapbox.com/mapbox-gl-js/v1.13.1/mapbox-gl.js'></script>
<script src="https://www.unpkg.com/@watergis/mapbox-gl-export@latest/dist/mapbox-gl-export.umd.js"></script>
<script>
map.addControl(new MapboxExportControl({
PageSize: Size.A3,
PageOrientation: PageOrientation.Portrait,
Format: Format.PNG,
DPI: DPI[96],
Crosshair: true,
PrintableArea: true,
}), 'top-right');
</script>
<link href="https://www.unpkg.com/@watergis/[email protected]/dist/mapbox-gl-export.css" rel="stylesheet" />
<script src="https://www.unpkg.com/@watergis/[email protected]/dist/mapbox-gl-export.umd.js"></script>
```

Furthermore, you may download specific version's scripts and css locally from [release](https://github.com/watergis/maplibre-gl-export/releases) page.
- from jsdelivr

```html
<link href="https://cdn.jsdelivr.net/npm/@watergis/[email protected]/dist/mapbox-gl-export.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/@watergis/[email protected]/dist/mapbox-gl-export.umd.js"></script>
``

See the sample code of [html](./index_cdn.html) and [JS](./index_cdn.js).

Alternatively, you can use `latest` tag for CDN instead of specific version (But any breaking changes may be in the future).

## Demo

Expand Down
31 changes: 16 additions & 15 deletions packages/maplibre-gl-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,25 @@ yarn add @watergis/maplibre-gl-export --save

## Use CDN

import JS and CSS from CDN.

- from unpkg.com

```html
<link href="https://www.unpkg.com/@watergis/[email protected]/dist/maplibre-gl-export.css" rel="stylesheet" />
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js"></script>
<script src="https://www.unpkg.com/@watergis/[email protected]/dist/maplibre-gl-export.umd.js"></script>
<script>
map.addControl(new MaplibreExportControl.MaplibreExportControl({
PageSize: MaplibreExportControl.Size.A4,
PageOrientation: MaplibreExportControl.PageOrientation.Landscape,
Format: MaplibreExportControl.Format.PNG,
DPI: MaplibreExportControl.DPI[300],
Crosshair: true,
PrintableArea: true,
Local: 'fr'
}), 'top-right');
</script>
<link href="https://www.unpkg.com/@watergis/[email protected]/dist/maplibre-gl-export.css" rel="stylesheet" />
<script src="https://www.unpkg.com/@watergis/[email protected]/dist/maplibre-gl-export.umd.js"></script>
```

Furthermore, you may download specific version's scripts and css locally from [release](https://github.com/watergis/maplibre-gl-export/releases) page.
- from jsdelivr

```html
<link href="https://cdn.jsdelivr.net/npm/@watergis/[email protected]/dist/maplibre-gl-export.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/@watergis/[email protected]/dist/maplibre-gl-export.umd.js"></script>
``

See the sample code [here](./index_cdn.html).

Alternatively, you can use `latest` tag for CDN instead of specific version (But any breaking changes may be in the future).

## Demo:

Expand Down

0 comments on commit 2eacdf0

Please sign in to comment.