Minimize Web Build
by aturbidflow
Godot "Minimize Web Build" Addon
A minification tool for Godot 4.3+ that automatically compresses files in your web build
Speeds up your game loading even if your server does not support gzip compression
DISCLAIMER
The compression ratio of a .pck file depends heavily on the set of assets in your project.
Loading speed depends on server settings.
On average, loading speed when using a plugin can be from 10% to 100% faster.
See comparison calculations here.
Supported host platforms (where your editor runs): Windows x64 only
Please create an issue if you need support for other operating systems.
Recent updates
- Threads & PWA support
- Custom templates support & disabled Head Includes override
- itch.io & servers with gzip compression support
How it works
The add-on resaves large files (.pck, .wasm) with gzip compression, minifies core files (.js and .html) and adds the ability to load gzip-compressed assets in the browser using pako. Nothing else will be changed in your files.
Usage
- Install the addon from AssetLib or from source (copy
addons
folder to your project directory) - Enable the plugin in your Project Settings.
- Export your project to Web.
Detailed explanation
Step-by-step algorythm
- Godot creates release files.
- The addon copies additional and temporary files to the build directory (pako.js, compressor, minifier)
- Using a tool written in Go (see
/vendor/bin/compress/src
in the plugin directory), the .pck and .wasm files are converted to a gzip enconding - Using minify by tdewolff, the core .html and .js files are minified.
- Using some crappy code, parts of the core JS and HTML files are slightly adapted to support the use of pako.
- The directory is cleared of temporary files (compressor, minifier).
Why Golang compresser?
It was painful to implement the encoder directly in Godot because of the "original" implementation of Gzip conversion. You can create a PR if you are brave enough to implement it.
Is it necessary to minify?
Nope, it does save a bit of size compared to gzip, but it makes js easier to update.
FAQ
Custom templates support
Honestly, it hasn't been tested. But you can try. If it doesn't work, feel free to create an issue.
Why Godot 4.0 - 4.2 aren't supported?
Because Godot had a broken web build until version 4.3. Actually, the addon works and compresses files on older versions, but the web build still doesn't work, so I don't recommend using it.
What about Godot 3.x?
There are no plans at the moment.
@aturbidflow – Telegram
Download
Support
If you need help or have questions about this plugin, please contact the author.
Contact Author