Skip to content

Commit

Permalink
Update docs for 2.0 dependency changes
Browse files Browse the repository at this point in the history
Mention requirement to install canvas, jsdom, and xmldom alongside
canvg for use in a server context.

Mention usage of canvg in a built browser application.

Update CDN links for rgbcolor and stackblur-canvas to use jsdelivr.
  • Loading branch information
bz2 committed Mar 5, 2019
1 parent a98c42d commit 2d75e00
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,7 +1,7 @@
# Change Log

## v2.0.0 (beta)
- **Breaking change**: now dependent on [canvas 2.x](https://github.com/Automattic/node-canvas)
- **Breaking change**: for use on server, peer dependencies [canvas 2.x](https://github.com/Automattic/node-canvas), [jsdom 13.x](https://github.com/jsdom/jsdom) and [xmldom 0.x](https://github.com/jindw/xmldom) must be installed.
- Implement focal gradient radius ([#675](https://github.com/canvg/canvg/pull/675))
- Fixes 0 height rects ([#674](https://github.com/canvg/canvg/pull/674))
- Fixes masks with alpha ([#672](https://github.com/canvg/canvg/pull/672))
Expand Down
21 changes: 13 additions & 8 deletions README.md
Expand Up @@ -43,30 +43,35 @@ Locally, you can run `npm start` and view the examples at [http://localhost:3123

## Usage on the server

`npm install canvg`
`npm install canvg@^1.5`

**2.0.0 beta** (see [CHANGELOG](https://github.com/canvg/canvg/blob/master/CHANGELOG.md))

`npm install canvg@2.0.0-beta.0`
`npm install canvg@2.0.0-beta.0 canvas@^2 jsdom@^13 xmldom@^0`

## Usage on the Browser
The dependencies required on the server only are peers so must be installed
alongside the canvg package.

Include the following files in your page:
## Usage on the browser

For browser applications with a build process, canvg can be installed using `npm` similar to use on the server. Note in this case the peer dependencies are not required so do not need to be installed.

Alternatively, canvg can be included directly into a webpage:
```html
<!-- Required to convert named colors to RGB -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/canvg/1.4/rgbcolor.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/rgbcolor@^1/index.js"></script>
<!-- Optional if you want blur -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/stackblur-canvas/1.4.1/stackblur.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/stackblur-canvas@^1/dist/stackblur.min.js"></script>
<!-- Main canvg code -->
<script src="https://cdn.jsdelivr.net/npm/canvg/dist/browser/canvg.min.js"></script>
```

For the **2.0.0 beta** (see [CHANGELOG](https://github.com/canvg/canvg/blob/master/CHANGELOG.md)), use this:
```html
<!-- Required to convert named colors to RGB -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/canvg/1.4/rgbcolor.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/rgbcolor@^1/index.js"></script>
<!-- Optional if you want blur -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/stackblur-canvas/1.4.1/stackblur.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/stackblur-canvas@^1/dist/stackblur.min.js"></script>
<!-- Main canvg code -->
<script src="https://cdn.jsdelivr.net/npm/canvg@2.0.0-beta.0/dist/browser/canvg.min.js"></script>
```
Expand Down

0 comments on commit 2d75e00

Please sign in to comment.