The bundles carried all thirteen translations at once and a page fetched them a third time as raw source; each page now loads only its own language. Alongside that: JavaScript is minified, the eight stylesheets are served as one file, the QR scanner is fetched after the app is up instead of on every visit, Inter ships once rather than five copies of the same file, and Font Awesome is subset to the 82 icons this app draws instead of all 2468. 1.85 MB across 43 requests becomes under 700 KB across 33. On mobile the page starts drawing in 1.6 s instead of 6.3 s and is usable in 4.5 s instead of 11 s. Pages also carry their text in the HTML now. Everything was drawn by JavaScript into an empty div, so crawlers saw correct metadata around nothing, and twelve of the thirteen language pages had never been shown to anyone. The documentation is published under /docs/ with a new FAQ, and unknown addresses return a real 404. Separately: the localized shells were served with the year-long immutable cache header meant for static assets, which pinned anyone who opened /de/ or /ru/ to that build. The header is fixed and the service worker refreshes what it cached. Claude-Session: https://claude.ai/code/session_014KjzTXxrhzYoDDWChYQ4u2
24 lines
1.0 KiB
JavaScript
24 lines
1.0 KiB
JavaScript
// Loads non-render-critical stylesheets asynchronously so they don't block first
|
|
// paint. This runs from a deferred <script> (after the document is parsed), and only
|
|
// appends <link rel="stylesheet"> elements — no inline event handlers — so it stays
|
|
// within the page CSP (script-src 'self', style-src 'self' 'unsafe-inline').
|
|
//
|
|
// Deferred here (decorative / non-layout, not needed for the initial paint):
|
|
// - Prism (tiny): syntax-highlighting theme, only used inside code blocks in chat.
|
|
//
|
|
// FontAwesome used to be the reason this file existed: 102 KB of stylesheet for 2468
|
|
// icons, of which the interface draws 82. Subset to those, it is 7 KB and rides in the
|
|
// main bundle instead, so the icons are styled from the first paint rather than a beat
|
|
// after it. See scripts/subset-icons.py.
|
|
(function () {
|
|
var sheets = [
|
|
'/libs/prism/prism.css'
|
|
];
|
|
for (var i = 0; i < sheets.length; i++) {
|
|
var link = document.createElement('link');
|
|
link.rel = 'stylesheet';
|
|
link.href = sheets[i];
|
|
document.head.appendChild(link);
|
|
}
|
|
})();
|