site-gen

command
v0.1.145 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 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 /SUBDOMAIN, path with /, e.g. for SUBDOMAIN "learn" /learn/banana becomes /banana. Replace all paths to subdomain as above for "apex" subdomain.
  • 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"
  • Copy .js files with their original filename so that clients that do not support import map can still import the .js files. They miss out on cache busting and may need to sometimes force-reload.
  • 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