From b942635f22ecadace16dcf581dd3411d3be0b051 Mon Sep 17 00:00:00 2001 From: Jack Hou Date: Sun, 17 Dec 2023 13:19:34 +0100 Subject: [PATCH 1/2] Add Trunk.toml and make urls relative. This enables IDEs to live preview `dist/index.html` without any extra config (since they usually default to serving the whole repo). It also allows the template to work as-is on itch.io and any other services that serve the package under some path. --- Trunk.toml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Trunk.toml diff --git a/Trunk.toml b/Trunk.toml new file mode 100644 index 0000000..36598c5 --- /dev/null +++ b/Trunk.toml @@ -0,0 +1,5 @@ +[build] +public_url = "./" + +[serve] +port = 8080 From ff4b518b3e1d35fb181b8f0775724bd19d7df8eb Mon Sep 17 00:00:00 2001 From: Jack Hou Date: Thu, 28 Dec 2023 10:32:53 +0100 Subject: [PATCH 2/2] Remove relative path step from release.yaml. --- .github/workflows/release.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 550e0a9..3d21f40 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,8 +13,7 @@ on: # ToDo: adapt names env: - # heads-up: this value is used as a pattern in an sed command as a workaround for a trunk issue - # if you use special characters, take a look at the 'Make paths relative' step in the 'build-web' job + # This variable is used to name release output files. GAME_EXECUTABLE_NAME: bevy_game GAME_OSX_APP_NAME: BevyGame @@ -198,12 +197,6 @@ jobs: uses: NiklasEi/wasm-opt-action@v2 with: file: dist/*.wasm - # Trunk cannot import assets from relative paths (see e.g. https://github.com/thedodd/trunk/issues/395) - # On sites like itch.io, we don't know on which base path the game gets served, so we need to rewrite all links to be relative - - name: Make paths relative - run: | - sed -i 's/\/index/.\/index/g' dist/index.html - sed -i 's/\/${{ env.GAME_EXECUTABLE_NAME }}/.\/${{ env.GAME_EXECUTABLE_NAME }}/g' dist/index.html - name: Zip release uses: vimtor/action-zip@v1 with: