From 7941db73dbdaed3b2979f245df14bda4fdfba992 Mon Sep 17 00:00:00 2001 From: Wolfger Schramm Date: Thu, 29 Aug 2024 16:09:00 +0200 Subject: [PATCH] fix astro-rainbow-line --- packages/astro-rainbow-line/README.md | 3 ++- packages/astro-rainbow-line/RainbowLine.astro | 6 +++++- packages/astro-rainbow-line/package.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/astro-rainbow-line/README.md b/packages/astro-rainbow-line/README.md index 87f8d9f..e0dc594 100644 --- a/packages/astro-rainbow-line/README.md +++ b/packages/astro-rainbow-line/README.md @@ -2,4 +2,5 @@ An astro wrapper for the [rainbow-line web component](https://github.com/spearwolf/visual-fx-web-components/tree/main/packages/rainbow-line). -> It is currently assumed that the [rainbow-line.js](./rainbow-line-v0.2.1.js) is located under `${import.meta.env.BASE_URL}/js/rainbow-line-v0.2.1.js`. +> It is currently assumed that the [rainbow-line.js](./rainbow-line-v0.2.1.js) is located under `${import.meta.env.BASE_URL}/js/rainbow-line-v0.2.1.js` +> or set the `RAINBOW_LINE_JS` environment variable to a different location than `js/rainbow-line-v0.2.1.js` by editing your `.env` file diff --git a/packages/astro-rainbow-line/RainbowLine.astro b/packages/astro-rainbow-line/RainbowLine.astro index 0af8256..6a5a21b 100644 --- a/packages/astro-rainbow-line/RainbowLine.astro +++ b/packages/astro-rainbow-line/RainbowLine.astro @@ -7,6 +7,10 @@ interface Props { } const {shadow = false, colorSliceWidth = 10, sliceCycleTime = 7, cycleDirection = 'right'} = Astro.props; + +const baseUrl = import.meta.env.BASE_URL; +const rainbowLineJs = import.meta.env.RAINBOW_LINE_JS || 'js/rainbow-line-v0.2.1.js'; +const rainbowLineSrc = `${baseUrl}${baseUrl.endsWith('/') ? '' : '/'}${rainbowLineJs}`; --- +