From 40ea2dd1f600781f5b710f9b13de50293ab707c5 Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Thu, 3 Oct 2024 21:58:03 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=A0=20Support=20favicon=20in=20static?= =?UTF-8?q?=20builds=20(#1565)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #1449 --- .changeset/red-swans-remain.md | 5 +++++ packages/myst-cli/src/build/html/index.ts | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .changeset/red-swans-remain.md diff --git a/.changeset/red-swans-remain.md b/.changeset/red-swans-remain.md new file mode 100644 index 000000000..d8e3eaee9 --- /dev/null +++ b/.changeset/red-swans-remain.md @@ -0,0 +1,5 @@ +--- +"myst-cli": patch +--- + +Fix favicon writing diff --git a/packages/myst-cli/src/build/html/index.ts b/packages/myst-cli/src/build/html/index.ts index c42590b1c..22292c743 100644 --- a/packages/myst-cli/src/build/html/index.ts +++ b/packages/myst-cli/src/build/html/index.ts @@ -81,10 +81,9 @@ function rewriteAssetsFolder(directory: string, baseurl?: string): void { } if (!['.html', '.js', '.json'].includes(path.extname(file))) return; const data = fs.readFileSync(file).toString(); - const modified = data.replace( - new RegExp(`\\/${ASSETS_FOLDER}\\/`, 'g'), - `${baseurl || ''}/build/`, - ); + const modified = data + .replace(new RegExp(`\\/${ASSETS_FOLDER}\\/`, 'g'), `${baseurl || ''}/build/`) + .replace('href="/favicon.ico"', `href="${baseurl || ''}/favicon.ico"`); fs.writeFileSync(file, modified); }); }