Skip to content

Commit

Permalink
fix(#927): tabler-icons-filledのフォントを参照できない問題を修正 (#929)
Browse files Browse the repository at this point in the history
  • Loading branch information
u1-liquid authored Feb 1, 2025
1 parent 1d9a54e commit a55ee2c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions packages/backend/src/server/web/views/base.pug
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ html
link(rel='prefetch' href=notFoundImageUrl)
//- https://github.com/misskey-dev/misskey/issues/9842
link(rel='stylesheet' href=`/assets/tabler-icons.${version}/dist/tabler-icons-outline.min.css`)
link(rel='stylesheet' href=`/assets/tabler-icons.${version}/dist/tabler-icons-filled.min.css`)
link(rel='modulepreload' href=`/vite/${clientEntry.file}`)

if !config.clientManifestExists
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/.storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true" as="image" type="image/png" crossorigin="anonymous">
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true" as="image" type="image/jpeg" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/@tabler/icons-webfont@latest/dist/tabler-icons-outline.min.css">
<link rel="stylesheet" href="https://unpkg.com/@tabler/icons-webfont@latest/dist/tabler-icons.min.css">
<link rel="stylesheet" href="https://unpkg.com/@fontsource/m-plus-rounded-1c/index.css">
<style>
html {
Expand Down
4 changes: 0 additions & 4 deletions packages/frontend/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/

@use '@tabler/icons-webfont/dist/tabler-icons-filled' with (
$ti-prefix: 'ti-filled'
);

:root {
--radius: 12px;
--marginFull: 16px;
Expand Down
28 changes: 19 additions & 9 deletions scripts/build-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ async function copyFrontendFonts() {

async function copyFrontendTablerIcons() {
await fs.cp('./packages/frontend/node_modules/@tabler/icons-webfont', `./built/_frontend_dist_/tabler-icons.${meta.version}`, { dereference: true, recursive: true });
for (const file of [
`./built/_frontend_dist_/tabler-icons.${meta.version}/dist/tabler-icons-filled.scss`,
`./built/_frontend_dist_/tabler-icons.${meta.version}/dist/tabler-icons-filled.css`,
`./built/_frontend_dist_/tabler-icons.${meta.version}/dist/tabler-icons-filled.min.css`,
]) {
let source = await fs.readFile(file, { encoding: 'utf-8' });
source = source.replaceAll('$ti-prefix: \'ti\'', '$ti-prefix: \'ti-filled\'');
source = source.replaceAll('.ti', '.ti-filled');
await fs.writeFile(file, source);
}
}

async function copyFrontendLocales() {
Expand Down Expand Up @@ -91,13 +101,13 @@ async function build() {
await build();

if (process.argv.includes("--watch")) {
const watcher = fs.watch('./locales');
for await (const event of watcher) {
const filename = event.filename?.replaceAll('\\', '/');
if (/^[a-z]+-[A-Z]+\.yml/.test(filename)) {
console.log(`update ${filename} ...`)
locales = buildLocales();
await copyFrontendLocales()
}
}
const watcher = fs.watch('./locales');
for await (const event of watcher) {
const filename = event.filename?.replaceAll('\\', '/');
if (/^[a-z]+-[A-Z]+\.yml/.test(filename)) {
console.log(`update ${filename} ...`)
locales = buildLocales();
await copyFrontendLocales()
}
}
}

0 comments on commit a55ee2c

Please sign in to comment.