Open thedodd opened 4 years ago
How about also optimizing PNGs?
Sounds good to me. I’ll add it to the list above. Any ideas on libraries/algorithms we can use to accomplish this? I can’t say I’ve done much PNG optimization, I’d have to do some research on it.
We can add a new pipeline handler which handles PNGs specifically and does optimization as part of the pipeline.
We need to minify also Rust/WASM.
For instance, the difference in *.wasm
file size between wasm-pack
and Trunk
for one my Seed app is ~700 KB in release mode.
This minification is related to https://github.com/thedodd/trunk/issues/5 because we would need to use wasm-opt.
@MartinKavik agreed. Release mode still makes a big difference, however there is no wasm-opt integration quite yet. We definitely need to get that added in.
How about minifying the generated JavaScript?
Tried implementing this, but the JS minifiers I found on crates.io had problems - one broke wasm-bindgen generated JavaScript and the other couldn't parse it properly, but the author seems fairly active on github so I created an issue on his parser.
Will create pull request for CSS and HTML, but JS will have to wait and I feel that's the biggest bit.
What is the state of JS minifiers in trunk 18? The documentation on the website says that <script data-trunk ...
copies scripts as-is. However I'm currently testing a project that uses hljs from an already minified bundle, which works in dev, but when I build it in prod, it becomes broken. The public name (hljs
) gets minified away and one of the methods doesn't seem to exist, so code that depends on it just crashes.
Trunk 0.18.0 adds minification of css and html too. If you find an issue I would ask you to raise a new issue, so that we can track it. At best, having a reproducer would be helpful.
This primarily applies to: