site-gen

command
v0.1.37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Command site-gen generates the website files to be deployed to firebase.

Usage: site-gen <src-dir> <dest-dir> <domain>

When deploying to firebase (any other hosting site), we need to make a few changes to the HTML, CSS and JS files in the site:

  • Replace href/values with leading paths of /discord, /docs, /learn and /play with a subdomain instead, so /docs/foo with docs.<domain>/foo
  • Rename .css, .js and .wasm files to include a short-sha of the SHA256 of the contents of the file and update any references to those files in .html files to include the filename with the short-sha. This is to perform cache busting when the files change.
  • Update the importmap in .html files to include the short-sha in the javascript imports. e.g. "./module/editor.js": "./module/editor.js" becomes "./module/editor.js": "./module/editor.1a2b3c4d.js"
  • Update the wasmImports map in .html files to include the short-sha in wasm imports. The wasmImports allows for cache busting hashed filenames for wasm files. The replacements are of the same form as the importmap.

The site generation process copies the source hierarchy to a destination directory and performs these updates as it copies the files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL