From 4a6df7664fcf0c99d5e33317cfd725ab628ff971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20de=20Metz?= Date: Sun, 26 May 2024 12:00:42 +0200 Subject: [PATCH] Add vite configuration. --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 0575cea..659da19 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,36 @@ const indoorequal = new IndoorEqual(map, { apiKey: 'myKey' }); indoorequal.loadSprite('/indoorequal'); ``` +**Usage with [vite](https://vitejs.dev/)** + +Install the +[vite-plugin-static-copy](https://github.com/sapphi-red/vite-plugin-static-copy) +package and add to your vite config: + +```javascript +import { viteStaticCopy } from 'vite-plugin-static-copy' + +export default { + plugins: [ + viteStaticCopy({ + targets: [ + { + src: 'node_modules/maplibre-gl-indoorequal/sprite, + dest: 'indoorequal' + } + ] + }) + ] +} +``` + +Then load the sprite: + +```javascript +const indoorequal = new IndoorEqual(map, { apiKey: 'myKey' }); +indoorequal.loadSprite('/indoorequal'); +``` + ## API