Skip to content

Commit

Permalink
chore: add readme & vite lib config
Browse files Browse the repository at this point in the history
  • Loading branch information
Quozul committed Jun 15, 2024
1 parent a5788ca commit d3cf40d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# canvas-image
A canvas to view image, zoom and pan.

## Usage

### Vanilla HTML
```html
<canvas-image src="https://quozul.github.io/canvas-image/image-landscape.jpg"></canvas-image>
<script src="https://quozul.github.io/canvas-image/canvas-image.js"></script>
```
> :warning: GitHub Pages is not a CDN, so you should download the `canvas-image.js` file locally!
4 changes: 2 additions & 2 deletions index.html → public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Canvas image</title>
<link href="/style.css" rel="stylesheet" type="text/css">
<link href="/canvas-image/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<canvas-image src="/canvas-image/image-landscape.jpg"></canvas-image>
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/canvas-image/canvas-image.js"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { defineConfig } from "vite";
import { resolve } from "node:path";

// https://vitejs.dev/config/
export default defineConfig({
base: "/canvas-image/",
build: {
lib: {
entry: resolve(__dirname, "src/main.ts"),
name: "canvas-image",
fileName: "canvas-image",
},
},
});

0 comments on commit d3cf40d

Please sign in to comment.