Skip to content

Commit 2d75e00

Browse files
committed
Update docs for 2.0 dependency changes
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.
1 parent a98c42d commit 2d75e00

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Change Log
22

33
## v2.0.0 (beta)
4-
- **Breaking change**: now dependent on [canvas 2.x](https://github.com/Automattic/node-canvas)
4+
- **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.
55
- Implement focal gradient radius ([#675](https://github.com/canvg/canvg/pull/675))
66
- Fixes 0 height rects ([#674](https://github.com/canvg/canvg/pull/674))
77
- Fixes masks with alpha ([#672](https://github.com/canvg/canvg/pull/672))

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,35 @@ Locally, you can run `npm start` and view the examples at [http://localhost:3123
4343

4444
## Usage on the server
4545

46-
`npm install canvg`
46+
`npm install canvg@^1.5`
4747

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

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

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

54-
Include the following files in your page:
55+
## Usage on the browser
56+
57+
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.
58+
59+
Alternatively, canvg can be included directly into a webpage:
5560
```html
5661
<!-- Required to convert named colors to RGB -->
57-
<script src="https://cdnjs.cloudflare.com/ajax/libs/canvg/1.4/rgbcolor.min.js"></script>
62+
<script src="https://cdn.jsdelivr.net/npm/rgbcolor@^1/index.js"></script>
5863
<!-- Optional if you want blur -->
59-
<script src="https://cdnjs.cloudflare.com/ajax/libs/stackblur-canvas/1.4.1/stackblur.min.js"></script>
64+
<script src="https://cdn.jsdelivr.net/npm/stackblur-canvas@^1/dist/stackblur.min.js"></script>
6065
<!-- Main canvg code -->
6166
<script src="https://cdn.jsdelivr.net/npm/canvg/dist/browser/canvg.min.js"></script>
6267
```
6368

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy