Closed
Description
Describe the bug:
Using of the package adds unnecessary KaTeX fonts from flutter_math_fork to built resources in web. It increases the size and delays the loading of the Webapp.
HTML to reproduce the issue:
Reference flutter_html in dependencies:
dependencies:
flutter_html: ^2.1.0
Use it somewhere in code, e.g. in simple Hello-World created by Android-Studio
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("any")),
body: Html(data: "something",), <---- simple using of package
);
}
Build web project
flutter build web
Built web contains a lot of KaTeX fonts with 660 kB even if they are nowhere used or referenced:
$ ls build/web/assets/packages/flutter_math_fork/lib/katex_fonts/fonts/
KaTeX_AMS-Regular.ttf KaTeX_Fraktur-Bold.ttf KaTeX_Main-BoldItalic.ttf KaTeX_Math-BoldItalic.ttf KaTeX_SansSerif-Italic.ttf KaTeX_Size1-Regular.ttf KaTeX_Size4-Regular.ttf
KaTeX_Caligraphic-Bold.ttf KaTeX_Fraktur-Regular.ttf KaTeX_Main-Italic.ttf KaTeX_Math-Italic.ttf KaTeX_SansSerif-Regular.ttf KaTeX_Size2-Regular.ttf KaTeX_Typewriter-Regular.ttf
KaTeX_Caligraphic-Regular.ttf KaTeX_Main-Bold.ttf KaTeX_Main-Regular.ttf KaTeX_SansSerif-Bold.ttf KaTeX_Script-Regular.ttf KaTeX_Size3-Regular.ttf
$ du -sh build/web/assets/packages/flutter_math_fork/lib/katex_fonts/fonts/
660K build/web/assets/packages/flutter_math_fork/lib/katex_fonts/fonts/
and they all are added to built build/web/assets/FontManifest.json
Html
widget configuration:
See example above
Expected behavior:
No unused fonts and other resources should be added to built resources
Device details and Flutter/Dart/flutter_html
versions:
Flutter 2.2.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d79295af24 (6 weeks ago) • 2021-06-11 08:56:01 -0700
Engine • revision 91c9fc8fe0
Tools • Dart 2.13.3