merge: cache-bursting for stylesheets and fonts (!557)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/557

Approved-by: Leah <kevinlukej@gmail.com>
Approved-by: Tess K <me@thvxl.se>
This commit is contained in:
dakkar 2024-06-21 12:22:27 +00:00
commit 52bb428fdb
2 changed files with 16 additions and 2 deletions

View file

@ -40,8 +40,8 @@ html
link(rel='prefetch' href=infoImageUrl)
link(rel='prefetch' href=notFoundImageUrl)
//- https://github.com/misskey-dev/misskey/issues/9842
link(rel='stylesheet' href='/assets/phosphor-icons/bold/style.css')
link(rel='stylesheet' href='/static-assets/fonts/sharkey-icons/style.css')
link(rel='stylesheet' href=`/assets/phosphor-icons/bold/style.css?version=${version}`)
link(rel='stylesheet' href=`/static-assets/fonts/sharkey-icons/style.css?version=${version}`)
link(rel='modulepreload' href=`/vite/${clientEntry.file}`)
if !config.clientManifestExists

View file

@ -35,6 +35,20 @@ async function copyFrontendFonts() {
async function copyFrontendTablerIcons() {
await fs.cp('./packages/frontend/node_modules/@phosphor-icons/web/src', './built/_frontend_dist_/phosphor-icons', { dereference: true, recursive: true });
for (const file of [
'./built/_frontend_dist_/phosphor-icons/bold/style.css',
'./built/_frontend_dist_/phosphor-icons/duotone/style.css',
'./built/_frontend_dist_/phosphor-icons/fill/style.css',
'./built/_frontend_dist_/phosphor-icons/light/style.css',
'./built/_frontend_dist_/phosphor-icons/regular/style.css',
'./built/_frontend_dist_/phosphor-icons/thin/style.css',
]) {
let source = await fs.readFile(file, { encoding: 'utf-8' });
source = source.replaceAll(/(url\(.+?Phosphor.+?\.(?:[a-zA-Z0-9]+))/g, `$1?version=${meta.version}`);
await fs.writeFile(file, source);
}
}
async function copyFrontendLocales() {