Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: load spoqa font with webfontloader #99

Merged
merged 3 commits into from
May 16, 2024
Merged

fix: load spoqa font with webfontloader #99

merged 3 commits into from
May 16, 2024

Conversation

Hanna922
Copy link
Member

@Hanna922 Hanna922 commented May 16, 2024

1️⃣ 어떤 작업을 했나요? (Summary)

쉽지 않네요. 😇

우선 문제는 1.0.1에서 1.0.2로 올라가면서 터지게 되는데, 처음에는 https://github.com/yourssu/YDS-React/pull/53/files 여기서 index.html 파일에서 폰트를 부르는 것만이 원인인 줄 알았습니다. (이것도 문제는 맞습니다. 디자인 시스템 라이브러리는 index.html 파일을 사용하지 않기 때문에, index.html 파일에서 폰트 호출 시 로딩 X)
하지만 기존 @import 방식으로 되돌려도 정상 로딩 되지 않았습니다.

why?

라이브러리 배포 시 원래 dist 폴더만 포함시키는 것이 일반적이지만, 1.0.1까지는 저희가 src 소스 코드까지 전부 포함해서 배포 중이었습니다.
따라서 @import 방식으로 폰트를 로딩 하더라도 src 내 globalStyle 파일을 참조하여 폰트를 로딩한 것으로 보입니다.

~1.0.1까지의 배포 형태

image

1.0.2부터 배포 형태

image

결국, 배포 형태가 바뀌면서 폰트 로딩 방식에 변화를 주어야 했고, webfontloader를 사용해서 비동기적으로 폰트를 로딩하는 방식을 채택하였습니다.

사용처 테스트도 전부 돌려보았고, 정상 출력되는거 확인했습니다.

image

2️⃣ 알아두시면 좋아요!

index.html 파일은 나중에 또 헷갈릴 수 있으니 그냥 삭제했습니다.

3️⃣ 추후 작업

이거랑 suffix icon PR 머지 후 진짜 1.1.1 배포.

4️⃣ 체크리스트 (Checklist)

  • main 브랜치의 최신 코드를 pull 받았나요?

@Hanna922 Hanna922 added bug Something isn't working fix labels May 16, 2024
@Hanna922 Hanna922 self-assigned this May 16, 2024
@Hanna922 Hanna922 requested a review from nijuy as a code owner May 16, 2024 07:58
@minai621
Copy link

좋네요
라이브러리에서 preload나 이런것도 해주나요?

Copy link
Collaborator

@nijuy nijuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm에서 차크라 같은 다른 디자인 시스템 쳐보니까 본문처럼 dist 폴더만 있네요 헉. 배워갑니다......👍

@Hanna922
Copy link
Member Author

Hanna922 commented May 16, 2024

라이브러리에서 preload나 이런것도 해주나요?

font preload요?? 라이브러리 preinstall 말씀하시는 거라면 따로 설정해주지 않았습니당

@Hanna922 Hanna922 merged commit 3d0b90a into develop May 16, 2024
1 check passed
@Hanna922 Hanna922 deleted the fix/#98-font branch May 16, 2024 12:44
@nijuy nijuy mentioned this pull request Jul 10, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: sans font not load
3 participants