Skip to content

Commit

Permalink
docs: fix standalone examples (#12)
Browse files Browse the repository at this point in the history
- add minimal stylesheet so control-panel works
- alias source version of package to support debugging use-cases
  • Loading branch information
usefulthink authored Oct 4, 2023
1 parent 27c4f63 commit ce482f2
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 4 deletions.
2 changes: 2 additions & 0 deletions examples/_template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<style>
body {
margin: 0;
font-family: sans-serif;
}
#app {
width: 100vw;
Expand All @@ -20,6 +21,7 @@
<body>
<div id="app"></div>
<script type="module">
import '../../website/src/styles.css';
import {renderToDom} from './src/app';
renderToDom(document.querySelector('#app'));
</script>
Expand Down
7 changes: 6 additions & 1 deletion examples/_template/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
/* @ts-check */
import {defineConfig, loadEnv} from 'vite';
import {resolve} from 'node:path';

export default defineConfig(({mode}) => {
const {GOOGLE_MAPS_API_KEY} = loadEnv(mode, process.cwd(), '');

return {
define: {
'process.env.GOOGLE_MAPS_API_KEY': JSON.stringify(GOOGLE_MAPS_API_KEY)
},
resolve: {
alias: {
'@vis.gl/react-google-maps': resolve('../../src/index.ts')
}
}
};
});
2 changes: 2 additions & 0 deletions examples/basic-map/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<style>
body {
margin: 0;
font-family: sans-serif;
}
#app {
width: 100vw;
Expand All @@ -22,6 +23,7 @@
<body>
<div id="app" style=""></div>
<script type="module">
import '../../website/src/styles.css';
import {renderToDom} from './src/app';
renderToDom(document.querySelector('#app'));
</script>
Expand Down
7 changes: 6 additions & 1 deletion examples/basic-map/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
/* @ts-check */
import {defineConfig, loadEnv} from 'vite';
import {resolve} from 'node:path';

export default defineConfig(({mode}) => {
const {GOOGLE_MAPS_API_KEY} = loadEnv(mode, process.cwd(), '');

return {
define: {
'process.env.GOOGLE_MAPS_API_KEY': JSON.stringify(GOOGLE_MAPS_API_KEY)
},
resolve: {
alias: {
'@vis.gl/react-google-maps': resolve('../../src/index.ts')
}
}
};
});
2 changes: 2 additions & 0 deletions examples/deckgl-overlay/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<style>
body {
margin: 0;
font-family: sans-serif;
}
#app {
width: 100vw;
Expand All @@ -20,6 +21,7 @@
<body>
<div id="app"></div>
<script type="module">
import '../../website/src/styles.css';
import {renderToDom} from './src/app';
renderToDom(document.querySelector('#app'));
</script>
Expand Down
7 changes: 6 additions & 1 deletion examples/deckgl-overlay/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
/* @ts-check */
import {defineConfig, loadEnv} from 'vite';
import {resolve} from 'node:path';

export default defineConfig(({mode}) => {
const {GOOGLE_MAPS_API_KEY} = loadEnv(mode, process.cwd(), '');

return {
define: {
'process.env.GOOGLE_MAPS_API_KEY': JSON.stringify(GOOGLE_MAPS_API_KEY)
},
resolve: {
alias: {
'@vis.gl/react-google-maps': resolve('../../src/index.ts')
}
}
};
});
2 changes: 2 additions & 0 deletions examples/markers-and-infowindows/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<style>
body {
margin: 0;
font-family: sans-serif;
}
#app {
width: 100vw;
Expand All @@ -20,6 +21,7 @@
<body>
<div id="app"></div>
<script type="module">
import '../../website/src/styles.css';
import {renderToDom} from './src/app';
renderToDom(document.querySelector('#app'));
</script>
Expand Down
7 changes: 6 additions & 1 deletion examples/markers-and-infowindows/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
/* @ts-check */
import {defineConfig, loadEnv} from 'vite';
import {resolve} from 'node:path';

export default defineConfig(({mode}) => {
const {GOOGLE_MAPS_API_KEY} = loadEnv(mode, process.cwd(), '');

return {
define: {
'process.env.GOOGLE_MAPS_API_KEY': JSON.stringify(GOOGLE_MAPS_API_KEY)
},
resolve: {
alias: {
'@vis.gl/react-google-maps': resolve('../../src/index.ts')
}
}
};
});

0 comments on commit ce482f2

Please sign in to comment.