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