Releasing for the Web¶
These instructions assume your WhaleJS project is located in $PROJECT directory.
Install Python 3.
Install Emscripten.
Download and extract WhaleJS Emscripten build. Let’s assume extracted files are located in
$WHALEdirectory.Activate Emscripten in your shell.
$ source emsdk_env.sh
Package your files with file_packager.py.
$ python3 $EMSDK/upstream/emscripten/tools/file_packager.py \ my_project.data \ --preload $PROJECT@/my_project \ --js-output=my_project.js
This will create two files:
my_project.data - File containing all packaged files from the project directory.
my_project.js - Script loading packaged files. It places them in
/my_projectdirectory of Emscripten virtual filesystem.
Gather files generated in step 5 and the following files in a single directory:
$WHALE/bin/index.html$WHALE/bin/whalejs.js$WHALE/bin/whalejs.wasm
Edit
index.htmlto load your project.canvas: canvasElement, // Select directory with your project files in filesystem package. arguments: ['demo'] }; </script> <script async type="text/javascript" src="whalejs.js"></script> <!-- Select filesystem package with your project files. --> <script async type="text/javascript" src="demo.js"></script> </body>In above fragment change all occurrences of
demotomy_project.
The newly created project directory is now ready for deployment.