The home page shows at once
It was blank until every module had loaded and the page's examples had been run, a fuzzer's report among them (about a second of work): first paint came 1.3 seconds into a repeat visit and about 3 into a first one. - The assembler draws the home page once, in Node, with the app's own homeView, and puts it inside #app. The browser paints it with the HTML and the stylesheet. - When the app has loaded it draws the page again, with its controls, and puts it in the prerendered one's place; the fuzzer's reports and the proof's counts are copied from the prerendered page, not worked out again. - The prerendered page shows only on the home address: the page's first inline script marks it before the first paint, and without the mark it stays hidden, so an embed or a problem's address never shows it. That script changed, and its hash in docs/Caddyfile with it. Served locally, first paint is at 0.1 to 0.2 seconds and the page with its controls at 0.2 to 0.3; both were at 1.2 to 1.4.
This commit is contained in:
12 files changed
+154
-19
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ The site builds against pplus-core, the git submodule `core/`, at the commit thi
|
||||
|
||||
`pixi run site` tests the app and assembles `site/`; `pixi run deploy [slug] [user@host]` does that and publishes it. CI (`.gitea/workflows/deploy.yml`) runs `pixi run ci` (the site's tests and core's `mojo-status-strict`) on every push and pull request, and on a push to `main` checks the chain of pointers (`pixi run release-check`), assembles and publishes.
|
||||
|
||||
The site is seven things: `index.html`, `styles.css`, `fonts/` (IBM Plex, served by the site so a visit asks no font host for anything; `fonts/README.md` says where the files came from), `styles/` (the course's widget styles, which the Hardware area's machine views use), `dist/`, `core/` (pplus-core's built `core/dist/`, which `index.html`'s import map names as `#core/`), and the Quarto extension (`quarto/_extensions/pplus`, without an engine copy), which the With Quarto page loads (`pplus.css`, `pplus.js`) and links to file by file. `scripts/assemble.sh` copies them into `site/` with a `VERSION` file holding the commit, a `build.json` naming the three commits the site was built from (below), and the license and notices (`LICENSE.md`, `NOTICE.md`, `THIRD_PARTY.md`, which the footer links), then `scripts/assemble-page.mjs` adds two things to `site/index.html`: the commit as `<meta name="pplus-version">`, which the footer shows, and a `<link rel="modulepreload">` for every module the page's imports reach, after the import map, so a first visit asks for all of them at once instead of one level of imports at a time (`tests/load.test.mjs` holds the list to the import graph and the inline scripts to their hashes). And `scripts/deploy.sh <slug> [user@host]` publishes `site/` to `/srv/www/<slug>` as an atomic release:
|
||||
The site is seven things: `index.html`, `styles.css`, `fonts/` (IBM Plex, served by the site so a visit asks no font host for anything; `fonts/README.md` says where the files came from), `styles/` (the course's widget styles, which the Hardware area's machine views use), `dist/`, `core/` (pplus-core's built `core/dist/`, which `index.html`'s import map names as `#core/`), and the Quarto extension (`quarto/_extensions/pplus`, without an engine copy), which the With Quarto page loads (`pplus.css`, `pplus.js`) and links to file by file. `scripts/assemble.sh` copies them into `site/` with a `VERSION` file holding the commit, a `build.json` naming the three commits the site was built from (below), and the license and notices (`LICENSE.md`, `NOTICE.md`, `THIRD_PARTY.md`, which the footer links), then `scripts/assemble-page.mjs` adds three things to `site/index.html`: the commit as `<meta name="pplus-version">`, which the footer shows; a `<link rel="modulepreload">` for every module the page's imports reach, after the import map, so a first visit asks for all of them at once instead of one level of imports at a time; and the home page already drawn, inside `#app` (`tests/load.test.mjs` holds the list to the import graph, the inline scripts to their hashes, and the prerendered page to its place). **The home page is prerendered** because drawing it runs the engines on its own examples, a fuzzer's report among them, about a second of work that came after 150 modules had loaded: a visitor saw nothing for 1.3 to 3 seconds. The assembler draws it once in Node with the app's own `homeView` (on the small document the Quarto views use), so the browser paints it with the HTML and the stylesheet, in about a tenth of a second; when the app has loaded it draws the page again, with its controls, and puts it in the prerendered one's place, copying the two costly parts from it instead of working them out again (`src/ui/prerender.ts`). The prerendered page shows only on the home address: the page's first inline script marks it before the first paint, and without the mark it stays hidden, so an embed or a problem's address never shows the home page first. A checkout served as it is (`pixi run dev`) has no prerendered page and draws the home page as before. And `scripts/deploy.sh <slug> [user@host]` publishes `site/` to `/srv/www/<slug>` as an atomic release:
|
||||
|
||||
```
|
||||
/srv/www/pplus -> symlink to the live release
|
||||
|
||||
Reference in new issue
Block a user