Treeshaking fonts - How to reduce a font's filesize #11215
-
|
I see my Vue + Quasar application is importing the material-icons.css styles which results the fetching of a ~120kB .woff2 font file. Before I start to edit somehow the font file to a custom font with only two characters, I wanted to ask you what is the good practice to reduce the unnecessary network load in this case. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Yes! |
Beta Was this translation helpful? Give feedback.
-
|
Thank you hawkeye64 for pointing me in the right direction. |
Beta Was this translation helpful? Give feedback.
-
|
Hi, I do not want to open the new discussion so I will ask here. I have the same problem, but with material symbols outlined. In my old project I managed to reduce the original woff2 file from 3.4MB to 900kB, which was quite acceptable for me. I did it by specifying only the font parameters I needed:
which inside has this url:
The quasar project in extras/build/material-symbols.js seems to fetch the whole woff2 font without possibility to specify option parameters in url:
Is it possible to somehow achieve this in quasar? Thanks. |
Beta Was this translation helpful? Give feedback.
@cimpok
Yes!
For icons, IMO, it's best to ditch the font (woff, woff2) files altogether and use the SVG version for tree-shaking. See here for more info: https://quasar.dev/vue-components/icon#svg-icons