Skip to content

Commit dc2f3c0

Browse files
committed
feat: FOUTを防止
1 parent cfd311b commit dc2f3c0

File tree

4 files changed

+62
-38
lines changed

4 files changed

+62
-38
lines changed

Diff for: package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
"dependencies": {
1616
"@astrojs/mdx": "^4.0.8",
1717
"@astrojs/sitemap": "^3.2.1",
18-
"@fontsource/zen-kaku-gothic-new": "^5.1.1",
1918
"astro": "^5.2.1",
2019
"astro-auto-import": "^0.4.4",
2120
"marked": "^15.0.6",
2221
"remeda": "^2.20.0",
2322
"sass": "^1.83.4",
2423
"sharp": "^0.33.5",
25-
"swiper": "^11.2.2"
24+
"swiper": "^11.2.2",
25+
"webfontloader": "^1.6.28"
2626
},
2727
"devDependencies": {
28+
"@types/webfontloader": "^1.6.38",
2829
"axios": "^1.7.9",
2930
"jiti": "^2.4.2",
3031
"prettier": "^3.4.2",

Diff for: pnpm-lock.yaml

+16-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/layouts/Layout.astro

+43-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
import { PRELOAD_IMAGE_MAP } from '@/utils/images';
33
import Header from '@/components/Header/index.astro';
44
import Footer from '@/components/Footer/index.astro';
5-
import '@/styles/globals.scss';
6-
import '@fontsource/zen-kaku-gothic-new';
7-
import '@fontsource/zen-kaku-gothic-new/300.css';
8-
import '@fontsource/zen-kaku-gothic-new/500.css';
9-
import '@fontsource/zen-kaku-gothic-new/900.css';
105
import {
116
CATEGORY,
127
DESCRIPTION,
@@ -43,6 +38,9 @@ ogpImageUrl.searchParams.append('v', Date.now().toString());
4338
<meta name="generator" content={Astro.generator} />
4439
{Object.values(PRELOAD_IMAGE_MAP).map((value) => <link rel="preload" href={value} as="image" />)}
4540
<title>{title == undefined ? 'システム工学研究会' : `${title} | シス研`}</title>
41+
<link rel="preconnect" href="https://fonts.googleapis.com" />
42+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
43+
<link href="https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New&display=swap" rel="stylesheet" />
4644

4745
<meta name="description" content={DESCRIPTION} />
4846
<meta name="application-name" content={SITE_NAME} />
@@ -77,3 +75,43 @@ ogpImageUrl.searchParams.append('v', Date.now().toString());
7775
<Footer />
7876
</body>
7977
</html>
78+
79+
<style lang="scss" is:global>
80+
html:not(.wf-active) {
81+
visibility: hidden;
82+
}
83+
84+
:root {
85+
font-size: 16px;
86+
}
87+
88+
* {
89+
margin: 0;
90+
padding: 0;
91+
box-sizing: border-box;
92+
}
93+
94+
html,
95+
body {
96+
margin: 0;
97+
width: 100%;
98+
height: 100%;
99+
font-family: 'Zen Kaku Gothic New', sans-serif;
100+
letter-spacing: 0.5px;
101+
}
102+
103+
main {
104+
padding-top: $header-height;
105+
min-height: 100vh;
106+
}
107+
</style>
108+
109+
<script>
110+
import * as WebFont from 'webfontloader';
111+
112+
WebFont.load({
113+
google: {
114+
families: ['Zen Kaku Gothic New'],
115+
},
116+
});
117+
</script>

Diff for: src/styles/globals.scss

-23
This file was deleted.

0 commit comments

Comments
 (0)