Skip to content

Commit

Permalink
🌠 Support favicon in static builds (#1565)
Browse files Browse the repository at this point in the history
Fixes #1449
  • Loading branch information
rowanc1 authored Oct 4, 2024
1 parent c6b63a0 commit 40ea2dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-swans-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"myst-cli": patch
---

Fix favicon writing
7 changes: 3 additions & 4 deletions packages/myst-cli/src/build/html/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
Expand Down

0 comments on commit 40ea2dd

Please sign in to comment.