build: self-host Inter so the build doesn't fetch Google Fonts
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, nextjs, react
- Lĩnh vực
- build-system, frontend
Hướng nghiên cứu
Font được tải bằng next/font/google trong src/app/layout.jsx; Lexend trong cùng tệp đã dùng next/font/local, nên đó là mẫu cần sao chép. Commit một tệp Inter .woff2 latin có trọng số biến đổi vào src/fonts/, thay lệnh gọi Inter bằng localFont với cùng các thiết lập display và variable, và xóa import google. Hoàn tất khi npm run build thành công mà không có yêu cầu nào tới fonts.gstatic.com và biến --font-inter vẫn được phân giải.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
npm run build downloads the Inter font from Google Fonts on every build, so a network blip on the runner fails the build even when nothing in the source is wrong.
Where: src/app/layout.jsx loads Inter with next/font/google. Next.js fetches the font files from fonts.gstatic.com at build time. Lexend, in the same file, already avoids this by loading a committed file with next/font/local.
Seen in: gofr-dev/gofr's Website Build check (website-pr.yml) on gofr-dev/gofr#4583, run https://github.com/gofr-dev/gofr/actions/runs/41670963807. That PR only changed Go imports and one docs page. The build failed with:
FetchError: request to https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7W0Q5n-wU.woff2 failed
`next/font` error:
Failed to fetch `Inter` from Google Fonts.
> Build failed because of webpack errors
The same check passed on the previous run of that PR. The stage and prod workflows in gofr-dev/gofr build this site the same way, so a deploy can fail on this too.
Suggested fix: self-host Inter the way Lexend is already self-hosted.
- Commit Inter's variable-weight latin
.woff2(SIL Open Font License) tosrc/fonts/. - In
src/app/layout.jsx, replaceInter({ subsets: ['latin'], display: 'swap', variable: '--font-inter' })withlocalFont({ src: '../fonts/inter.woff2', display: 'swap', variable: '--font-inter' }), and drop thenext/font/googleimport.
The --font-inter CSS variable keeps its name, so no styles change. The build then makes no font requests at all. Visitors already get the font from the site's own origin, because next/font/google self-hosts the downloaded files, so the page itself does not change.
Related: #230 removes another build-time download (the sharp binary) for the same reason.
- Ngôn ngữ chính
- JavaScript
- Star
- 44
- Fork
- 44
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của gofr-dev/website
-
Homepage HTML shows "Trusted by 0+ Developers" to crawlersCó thể đã có người làm @thzgajendra đã nhận 38 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Dockerfile builder stage pins node:23.11.1 — a non-LTS line, EOL since 2025-06-01Có thể đã có người làm @akshat-kumar-singhal đã nhận 98 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
-
Add og:image preview cards to docs pagesCó thể đã có người làm @adamshatzkamer đã nhận 36 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
Tất cả issue của gofr-dev/website
Issue tương tự
-
nip27: long hashtag swallows the rest of the content, lone # gives an empty hashtagCó thể đã có người làm @bardrop đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
nbd-wtf/nostr-tools#578 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add `min-release-age` to .npmrcĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
h5bp/html5-boilerplate#3512 ·
-
documentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
githubnext/gh-aw-workshop#5752 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày