A game about smashing cubes.
If cloning repo fresh, first install dev dependencies with:
yarn
To launch a live reloading dev server, run:
yarn start
To perform an optimized final build, run:
yarn build
To perform a special build that concatenates all JS for CodePen, run:
yarn build:codepen
New JS files must be linked directly in index.html
. Order matters based on dependencies.
I'm not using a bundler so that I have complete control over all generated code (it's only an IIFE).
However, microbundle could be worth considering.
All JS is:
index.html
All CSS is minified and inlined.
HTML is minified.
Test files should be added at the bottom of index.html
with the other tests.
All tests will be run in the browser during development using a custom test runner. All tests, and the test runner itself are stripped out for final builds.
Assertions make use of @mjackson's expect library.
Included is a system for tracking performance of various subroutines and displaying the data in an on screen overlay. This is very helpful when running on various mobile devices in the wild.
To enable, set the value of showPerfMonitor
to true
in PERF.js
. To disable, set to false
.
Three functions are exposed by PERF.js
:
PERF_START
PERF_END
PERF_UPDATE
PERF_UPDATE
simply displays the performance timing output. It is called automatically in draw.js
.
To monitor a new subroutine, call:
PERF_START('name-of-subroutine');
at the start of the subroutine, and at the end call:
PERF_END('name-of-subroutine');
Always use single quotes for the name string, or the function invokation won't be removed for production build.
Care should also be taken to only use a subroutine name once throughout the entire program. If a name is reused, multiple subroutines will have their run times averaged.