You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now the size of scratch-render-fonts is ~1 MB, and it relies on external Webpack configurations to function properly. I believe the package size can be optimized by implementing the following measures:
Use the woff2 format instead of ttf/otf. The woff22 format is now widely supported across major browsers and offers significantly better compression rates compared to current two formats. For example, NotoSans-Medium.ttf shrinks from 453 KB to 169 KB after compression. After implementing this optimization, the bundle size can be reduced to approximately 700 KB. This change works without requiring any modifications to external code.
Use Vite instead of Webpack. Webpack adds some boilerplate code to ensure compatibility, but in most cases, this results in an increase in bundle size. Since this package is simple enough, switching to Vite is simple and can further reduce the bundle size to under 500 KB. This change requires modifying some external dependencies.
The first two points have been tested on the Scratch mod I maintain and work well (See https://github.com/Clipteam/clipcc-render-fonts); if you’re interested, I’d be happy to contribute these changes to the upstream repository
Now the size of scratch-render-fonts is ~1 MB, and it relies on external Webpack configurations to function properly. I believe the package size can be optimized by implementing the following measures:
NotoSans-Medium.ttfshrinks from 453 KB to 169 KB after compression. After implementing this optimization, the bundle size can be reduced to approximately 700 KB. This change works without requiring any modifications to external code.The first two points have been tested on the Scratch mod I maintain and work well (See https://github.com/Clipteam/clipcc-render-fonts); if you’re interested, I’d be happy to contribute these changes to the upstream repository