Skip to content

Create build scripts#42

Open
sukus21 wants to merge 1 commit intoxem:gh-pagesfrom
sukus21:build-scripts
Open

Create build scripts#42
sukus21 wants to merge 1 commit intoxem:gh-pagesfrom
sukus21:build-scripts

Conversation

@sukus21
Copy link

@sukus21 sukus21 commented Feb 13, 2026

Hi there 👋

First of all, super cool little engine you got here, I'm very impressed! I fell down the js13k rabbit hole the other day, and found this engine thanks to the "resources" section on the website.

Snooping around the repository for a bit, I noticed the lack of build instructions. It is also not clear which parts of the source are stripped out of the lite version, or how the minification (of JS and/or GLSL) or zipping is done. I did some guesswork, and arrived at some results that are close enough.

So what we have here is a build script, that runs the code through terser, and then manually minifies the shader code using a series of regular expressions.

I have a few ideas for how to decrease the byte size of the engine even further, but in order to properly test if they save space when zipped or not, I needed a base to work from.

I'm looking forward to hearing your feedback :)

Notes:

  • The zipped files are larger than the old ones, since they were a couple revisions out of date
  • The logic to check for plugins gets evaluated at compile time thanks to terser, so those checks are completely free in terms of byte cost

@sukus21 sukus21 force-pushed the build-scripts branch 2 times, most recently from e6054ab to 3ce7058 Compare February 13, 2026 23:15
@xem
Copy link
Owner

xem commented Feb 14, 2026

Hi and thank you for your message!
Glad that you enjoyed js13kgames. Have you seen the entries made with W.js ?
As you can see, a previous PR also attempts to automate the build but the person stopped responding.
Regarding the difference between normal and lite, the homepage (https://xem.github.io/W/) explains that the lite version doesn't have built-in shapes such as cubes and spheres, nor the smooth shading function (which is quite verbose).
There's also MicroW (https://xem.github.io/microW/), even smaller.
As for my own process, as I'm totally not at ease with build scripts, I minify the code manually with terser (https://xem.github.io/terser-online/) and zip it with zopfli (https://xem.github.io/zipzop/).
The repo is now quite old so I don't remember all the little manual adjustments I may have added, though your build script seems to be already very good.
I'm not able to test it currently, but I can accept your PR in a new branch and add a link to it (+ your name) in the readme and the homepage, if that's ok for you?

@sukus21
Copy link
Author

sukus21 commented Feb 14, 2026

That would be OK with me.

Looking at #29, there are a few changes from there I would like to incorporate into this branch, so give me another couple hours to get that done :)

* Added NPM build scripts
* Improved plugin workflow a little
* In-sourced shader minifier
* Removed ect binary from source tree (replaced with dev dependency)
@sukus21
Copy link
Author

sukus21 commented Feb 14, 2026

Ok, I updated a few things:

All of this combined makes it possible to build the minified and zipped versions on Windows, MacOS and Linux.

I am ready to merge now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants