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

feat(frontend): tabler-iconsのサブセット化 #15340

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

kakkokari-gtyih
Copy link
Contributor

@kakkokari-gtyih kakkokari-gtyih commented Jan 25, 2025

What

  • 本番ビルド時にfrontend/frontend-embedそれぞれのti-*クラスを抜き出し、使用されていないアイコンを除いたフォントを生成するように(万が一抜けていてもフルバージョンのファイルにフォールバックされる)
  • 開発モードではtabler-iconsがそのまま使用される

Why

クライアント読み込みの高速化

フォントファイル

  • frontend: 869kB → 56kB (93%削減)
  • frontend-embed: 869kB → 6kB (99.4%削減)

CSS

  • frontend: 241kB → 11.1kB (95%削減)
  • frontend-embed: 241kB → 1.5kB (99.3%削減)

Additional info (optional)

  • tabler-iconsのフォントファイルの形式が不正なためtablerのをそのまま使うと正常にビルドできなかったので暫定的に自前のものを使用しています。
  • 現時点では無かったので特に問題ありませんが、ti-${someVar} のようにアイコン名部分だけを動的に変化させるような書き方をするとアイコンが表示できなくなります(CONTRIBUTING.mdに追記済み)

Close #15332

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@github-actions github-actions bot added the packages/frontend Client side specific issue/PR label Jan 25, 2025
Copy link

codecov bot commented Jan 25, 2025

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 18.87%. Comparing base (791b450) to head (8252036).

Files with missing lines Patch % Lines
packages/frontend/src/_boot_.ts 0.00% 5 Missing ⚠️
...ackages/frontend/src/components/MkDrive.folder.vue 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #15340       +/-   ##
============================================
- Coverage    38.75%   18.87%   -19.89%     
============================================
  Files         1601      762      -839     
  Lines       204020   110765    -93255     
  Branches      4012     1231     -2781     
============================================
- Hits         79065    20903    -58162     
+ Misses      124319    89277    -35042     
+ Partials       636      585       -51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kakkokari-gtyih kakkokari-gtyih marked this pull request as ready for review January 25, 2025 07:50
@kakkokari-gtyih
Copy link
Contributor Author

ready

@kakkokari-gtyih
Copy link
Contributor Author

※フォールバックが必要ないならcss自体も要らないクラスを削除できるため更に小さくできる

やるか

@kakkokari-gtyih
Copy link
Contributor Author

やった

フォントファイル

  • frontend: 869kB → 56kB (93%削減)
  • frontend-embed: 869kB → 6kB (99.4%削減)

CSS

  • frontend: 241kB → 11.1kB (95%削減)
  • frontend-embed: 241kB → 1.5kB (99.3%削減)

@kakkokari-gtyih
Copy link
Contributor Author

コンフリクト解消

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/frontend Client side specific issue/PR
Projects
Development

Successfully merging this pull request may close these issues.

1 participant