Skip to content

Commit

Permalink
prepare example for github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Nölle committed Mar 23, 2022
1 parent 38186c1 commit bbde9c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This package provides a webcomponent `<canvas2d-zoom>` that can be used like a 2

## Content

* [Example](#example)
* [Installation](#installation)
* [Usage](#usage)
* [Configuration](#configuration)
Expand All @@ -12,6 +13,10 @@ This package provides a webcomponent `<canvas2d-zoom>` that can be used like a 2
* [Development](#development)
* [License](#license)

## Example

https://cnoelle.github.io/canvas2d-zoom/index.html

## Installation

Using `npm`:
Expand Down Expand Up @@ -91,7 +96,7 @@ The element remembers all calls to the [CanvasRenderingContext2D](https://develo

* Prerequisites: NodeJS/npm (a current version)
* Install dependencies: `npm install`
* Run: a sample HTML page is included in the repository, see [index.html](./index.html). Start the dev webserver with `npm run start`, then open the browser at http://localhost:8080.
* Run: a sample HTML page is included in the repository, see [index.html](./index.html). Start the dev webserver with `npm run start`, then open the browser at http://localhost:8080. Note: in order to run the sample page with the current source code instead of the latest published version replace the url https://unpkg.com/canvas2d-zoom@latest/dist/canvas2d-zoom.js by *"./bundle.js"* at the end of the html file.
* Tests: not yet

## License
Expand Down
7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ <h1>Canvas Zoom demo app</h1>
});
</script>
<script type="module">
// bundle.js here gets generated by webpack from src/canvas2d-zoom.ts
// To use the latest published version instead replace this with "https://unpkg.com/canvas2d-zoom@latest/dist/canvas2d-zoom.js"
import { Canvas2dZoom } from "./bundle.js";
// Here we use the latest published version from npmjs via unpkg"
// For local development replace the url by "./bundle.js" and run `npm run start`.
// This will start a webpack dev server that generates the file bundle.js from src/canvas2d-zoom.ts
import { Canvas2dZoom } from "https://unpkg.com/canvas2d-zoom@latest/dist/canvas2d-zoom.js";
Canvas2dZoom.register();
</script>
</body>

0 comments on commit bbde9c1

Please sign in to comment.