Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ghettovoice committed Jul 7, 2018
1 parent 87b0c93 commit 29d612e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,46 @@ seeded with [TileCache](http://tilecache.org/).

## Installation

Install it with NPM or Bower:
Install it with NPM (recommended):

```shell
# ES6 version for bundling with Webpack, Rollup and etc.
npm install ol ol-tilecache
# to use UMD version `openlayers` package should be installed
npm install openlayers

# to use with old `openlayers` package (not recommended)
npm install openlayers ol-tilecache
```

Or add from CDN:

```html
<script src="https://unpkg.com/openlayers@latest/dist/ol.js"></script>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.0.2/build/ol.js"></script>
<script src="https://unpkg.com/ol-tilecache@latest/dist/bundle.min.js"></script>
```

### Note
**Plugin is available in 2 versions: as UMD module and as ES2015 module:**
- **RECOMMENDED: ES2015 version (`dist/bundle.es.js`) should be used with [ol](https://www.npmjs.com/package/ol) package (you should
install it manually).**
- **UMD version (`dist/bundle[.min].js`) should be used with [openlayers](https://www.npmjs.com/package/openlayers) package.
- **UMD version (`dist/bundle[.min].js`) should be used with deprecated [openlayers](https://www.npmjs.com/package/openlayers) package.
You can install `ol` package as dev dependency to suppress NPM warning about required peer dependencies.**

## Usage

Plugin may be used as UMD module or ES2015 module:
Plugin may be used as ES2015 module (**recommended** with support of ol v5):

```js
// Use as ES2015 module (based on NPM package `ol`)
import Map from 'ol/map'
import Map from 'ol/Map'
...
import * as TileCacheUrlFn from 'ol-tilecache'
// or only what you need
import { createTileUrlFunction } from 'ol-tilecache'
```

Usage with deprecated `openlayers` package (ol v4)

```js
// Use as UMD module (based on NPM package `openlayers`)
const ol = require('openlayers')
...
Expand All @@ -54,7 +59,7 @@ const TileCacheUrlFn = require('ol-tilecache')

In Browser environment you should add **script** tag pointing to UMD module after OpenLayers js files.
```html
<script src="https://unpkg.com/openlayers@latest/dist/ol.js"></script>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.0.2/build/ol.js"></script>
<script src="https://unpkg.com/ol-tilecache@latest/dist/bundle.min.js"></script>
<script>
// plugin exports global variable TileCacheUrlFn
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ol-tilecache",
"version": "2.1.1",
"version": "2.2.0",
"description": "OpenLayers tile url function to load tile seeded with TileCache url scheme",
"main": "dist/bundle.js",
"module": "dist/bundle.es.js",
Expand Down

0 comments on commit 29d612e

Please sign in to comment.