From 6819b40b0e441d964f8955fb641e6f80b9f9e49d Mon Sep 17 00:00:00 2001 From: Vincent Fretin Date: Sun, 28 Jun 2026 10:38:57 +0200 Subject: [PATCH 1/2] Inject CodeSandbox button style into modified gh-pages examples Move the CodeSandbox "Open Sandbox" button to the top so it does not overlap the VR/AR enter buttons, only in the example pages where a CDN link was actually replaced. Co-Authored-By: Claude Opus 4.8 (1M context) --- scripts/preghpages.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/preghpages.js b/scripts/preghpages.js index 96b01f77825..03495ec44d1 100755 --- a/scripts/preghpages.js +++ b/scripts/preghpages.js @@ -29,14 +29,35 @@ shell.cp('-r', [ '*.md' ], 'gh-pages'); +// Track which HTML files had at least one link replaced, so the CodeSandbox +// style below is only injected into the examples we actually modified. +const modifiedFiles = new Set(); + function htmlReplace (before, after) { - replaceInFileSync({ + const results = replaceInFileSync({ from: before, to: after, files: 'gh-pages/**/*.html' }); + results.filter(result => result.hasChanged).forEach(result => modifiedFiles.add(result.file)); } htmlReplace('../../../dist/aframe-master.module.min.js', `https://aframe.io/releases/${aframeVersion}/aframe.module.min.js`); htmlReplace('../../../dist/aframe-master.js', `https://aframe.io/releases/${aframeVersion}/aframe.min.js`); htmlReplace(/\.\.\/\.\.\/\.\.\/super-three-package/g, `https://cdn.jsdelivr.net/npm/super-three@${threeVersion}`); + +// Move the CodeSandbox "Open Sandbox" button to the top so it does not overlap +// the VR/AR enter buttons, but only in the examples where a link was replaced. +if (modifiedFiles.size > 0) { + replaceInFileSync({ + from: '', + to: ` + `, + files: Array.from(modifiedFiles) + }); +} From dbebc50c8b3e535ebfebbd34fb8bd3da0f84e5f1 Mon Sep 17 00:00:00 2001 From: Vincent Fretin Date: Sun, 28 Jun 2026 11:40:28 +0200 Subject: [PATCH 2/2] Move the button to the top left, we have the settings panel on the top right on some examples --- scripts/preghpages.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/preghpages.js b/scripts/preghpages.js index 03495ec44d1..d86a6056066 100755 --- a/scripts/preghpages.js +++ b/scripts/preghpages.js @@ -53,8 +53,7 @@ if (modifiedFiles.size > 0) { from: '', to: ` `,