From 027c669ad7dd7fc4eebf8493489619cbabb8b9c8 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 3 Jan 2023 22:17:44 +0100 Subject: [PATCH 1/5] make prebake relative to BASE_URL --- website/src/repl/prebake.mjs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/website/src/repl/prebake.mjs b/website/src/repl/prebake.mjs index bdd7f8d3..27bf521c 100644 --- a/website/src/repl/prebake.mjs +++ b/website/src/repl/prebake.mjs @@ -1,17 +1,18 @@ import { Pattern, toMidi, valueToMidi } from '@strudel.cycles/core'; import { samples } from '@strudel.cycles/webaudio'; -export async function prebake({ baseDir = '' } = {}) { +export async function prebake() { + const { BASE_URL = '/' } = import.meta.env; // https://archive.org/details/SalamanderGrandPianoV3 // License: CC-by http://creativecommons.org/licenses/by/3.0/ Author: Alexander Holm return await Promise.all([ - samples('/piano.json', `${baseDir}/piano/`), + samples(`${BASE_URL}piano.json`, `${BASE_URL}piano/`), // https://github.com/sgossner/VCSL/ // https://api.github.com/repositories/126427031/contents/ // LICENSE: CC0 general-purpose - samples('/vcsl.json', 'github:sgossner/VCSL/master/'), - samples('/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/'), - samples('/EmuSP12.json', `${baseDir}/EmuSP12/`), + samples(`${BASE_URL}vcsl.json`, 'github:sgossner/VCSL/master/'), + samples(`${BASE_URL}tidal-drum-machines.json`, 'github:ritchse/tidal-drum-machines/main/machines/'), + samples(`${BASE_URL}EmuSP12.json`, `${BASE_URL}EmuSP12/`), // samples('github:tidalcycles/Dirt-Samples/master'), ]); } From 11d3251c67ac0b592d947dfef4696cf2b9d54fe3 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 3 Jan 2023 23:02:41 +0100 Subject: [PATCH 2/5] add base path + use relative links --- website/astro.config.mjs | 2 +- website/src/components/HeadCommon.astro | 12 +++++++++--- website/src/components/Header/Header.astro | 2 +- website/src/components/LeftSidebar/LeftSidebar.astro | 6 ++++-- website/src/components/PageContent/PageContent.astro | 3 ++- .../src/components/RightSidebar/RightSidebar.astro | 3 ++- .../src/components/RightSidebar/TableOfContents.tsx | 7 +++++-- website/src/pages/swatch/index.astro | 11 ++++++----- website/src/repl/prebake.mjs | 9 ++++----- 9 files changed, 34 insertions(+), 21 deletions(-) diff --git a/website/astro.config.mjs b/website/astro.config.mjs index 6714f548..9dca58df 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -31,7 +31,7 @@ export default defineConfig({ tailwind(), ], site: `https://strudel.tidalcycles.org`, - base: '', + base: '/', }); /* diff --git a/website/src/components/HeadCommon.astro b/website/src/components/HeadCommon.astro index 410e9b91..9a1ed6f8 100644 --- a/website/src/components/HeadCommon.astro +++ b/website/src/components/HeadCommon.astro @@ -1,5 +1,9 @@ --- import '../styles/index.css'; + +const { url } = Astro; +const { BASE_URL } = import.meta.env; +const base = url.origin + BASE_URL; --- @@ -7,9 +11,11 @@ import '../styles/index.css'; - + - + + + @@ -17,7 +23,7 @@ import '../styles/index.css'; - +