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

[optimization] Avoid to load whole material design font #1242

Merged
merged 2 commits into from
Apr 26, 2022
Merged

Conversation

sbernard31
Copy link
Contributor

@sbernard31 sbernard31 commented Apr 21, 2022

Issue

Currently we load the whole material design font, this is not so good 😬 ...

This is arround 350 Ko and 1.1Mo downloaded (depending format used by the browser) which is mainly not used.

This PR aims to use @mdi/js which supports webpack tree shaking to only get used icons.
See : https://stackoverflow.com/questions/57552261/vuetifyjs-adding-only-used-icons-to-build

Results

This PR removes warnings below raised by webpack (#1239):

asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  fonts/materialdesignicons-webfont.aaf5968f.eot (1.11 MiB)
  fonts/materialdesignicons-webfont.ad0f7b3f.woff2 (358 KiB)
  fonts/materialdesignicons-webfont.f5b84261.ttf (1.11 MiB)
  fonts/materialdesignicons-webfont.fabeafb8.woff (516 KiB)

Following Firefox devTools, among of data to load to open main web page is reduced about 600 ko :

  • from 1.67 Mo to 1.05 Mo for leshan-server-demo
  • from 1.62 Mo to 0.99 Mo for leshan-bsserver-demo

Both jars also reduce about ~600Ko :

  • from 15.1 Mo to 14.5 Mo for leshan-server-demo
  • from 13.2 Mo to 12,8 Mo for leshan-bsserver-demo

This also increases the lighthouse(#1240) score from ~10 point. (But score seems to not be exactly the same each runs...)
E.g. for server-demo (tested locally), before :
Capture d’écran de 2022-04-21 19-04-13
Then after :
Capture d’écran de 2022-04-21 19-03-44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant