Skip to content
/ def-html5-opt Public template

Nodejs tool that adds loading and caching optimizations to HTML5 web games exported from Defold

License

Notifications You must be signed in to change notification settings

thinknathan/def-html5-opt

Repository files navigation

Tool for Defold: Def HTML5 Opt

HTML5 Build Optimizer for Defold

CI GitHub License

Adds loading and caching optimizations to HTML5 web games exported from Defold.

  1. Minifies HTML and JS to reduce file size and speed loading
  2. Adds preload meta tags to speed up first boot
  3. Generates a service worker to persistently cache assets

Install

  1. Install Nodejs or equivalent

  2. Clone this project (or fork it in Github) git clone https://github.com/thinknathan/def-html5-opt

  3. Install dependencies npm i or yarn

Usage

  1. Build your HTML5 export from Defold
  2. Copy your game files into the copy-game-here folder (don't include the build report: exclude report.html and similar)

You can skip any of the following steps you don't want to run. This is the recommended order:

  1. Run yarn preload or npm run preload to add preload meta tags
  2. Run yarn minify or npm run minify to reduce the size of index.html and dmloader.js
  3. Run yarn sw or npm run sw to generate the service worker

Done! We've completed the modifications to your game in the copy-game-here folder.

Upload all the files inside copy-game-here to distribute your game.

Other potential optimizations

Since Defold's usage of emscripten lags behind the latest release, you may be able to gain an improvement to speed and/or file size by downloading the latest version of wasm-opt and running it on your wasm binary.

About

Nodejs tool that adds loading and caching optimizations to HTML5 web games exported from Defold

Topics

Resources

License

Stars

Watchers

Forks