Skip to content

Commit 3312e35

Browse files
SelvinPLavivace
andauthoredFeb 15, 2025
Template link to documentation using git tag from RGBDS (#69)
Co-authored-by: Antonio Vivace <avivace4@gmail.com>
1 parent 8c29b99 commit 3312e35

File tree

2 files changed

+31
-22
lines changed

2 files changed

+31
-22
lines changed
 

‎index.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
<ul>
5050
<li id="infomenu">Info...</li>
5151
<li>
52-
<a href="https://rgbds.gbdev.io/docs/v0.9.1" target="_blank">rgbds manual</a>
52+
<!-- This link is templated using the VITE_RGBDS_VERSION env variable, set at build time. See vite.config.js -->
53+
<a href="https://rgbds.gbdev.io/docs/%VITE_RGBDS_VERSION%" target="_blank">rgbds manual</a>
5354
</li>
5455
<li>
5556
<a href="https://github.com/gbdev/rgbds-live/issues" target="_blank">Report a problem</a>

‎vite.config.js

+29-21
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
import { defineConfig } from 'vite';
22
import { viteStaticCopy } from 'vite-plugin-static-copy';
3+
import { execSync } from 'node:child_process';
34

4-
export default defineConfig({
5-
base: '/rgbds-live/',
6-
build: {
7-
target: ['chrome109', 'safari15.6', 'firefox102'],
8-
outDir: 'www',
9-
chunkSizeWarningLimit: 1000,
10-
},
11-
resolve: {
12-
alias: {
13-
ace: 'ace-builds/src-noconflict/',
5+
export default defineConfig(({ command, mode, isSsrBuild, isPreview }) => {
6+
// Extract the RGBDS version we're using and set it as an env variable
7+
process.env.VITE_RGBDS_VERSION = execSync(
8+
"git --git-dir=rgbds/.git -c safe.directory='*' describe --tags --always",
9+
).toString('utf8');
10+
console.log("VITE_RGBDS_VERSION set to", process.env.VITE_RGBDS_VERSION)
11+
return {
12+
base: '/rgbds-live/',
13+
build: {
14+
target: ['chrome109', 'safari15.6', 'firefox102'],
15+
outDir: 'www',
16+
chunkSizeWarningLimit: 1000,
1417
},
15-
},
16-
plugins: [
17-
viteStaticCopy({
18-
targets: [
19-
{
20-
src: './node_modules/ace-builds/src-noconflict/**',
21-
dest: 'assets/ace',
22-
},
23-
],
24-
}),
25-
],
18+
resolve: {
19+
alias: {
20+
ace: 'ace-builds/src-noconflict/',
21+
},
22+
},
23+
plugins: [
24+
viteStaticCopy({
25+
targets: [
26+
{
27+
src: './node_modules/ace-builds/src-noconflict/**',
28+
dest: 'assets/ace',
29+
},
30+
],
31+
}),
32+
],
33+
};
2634
});

0 commit comments

Comments
 (0)
Failed to load comments.