System-default font stack ('-apple-system, BlinkMacSystemFont, Segoe UI,
…') is the textbook generic admin-tool look. The tools have a real point
of view (engineering documents, traceability, immutability); the
typography should reflect that.
Picks:
--font → IBM Plex Sans (400 + 600). UI body text. Distinctive
engineering sans with tabular nums and proper figures.
--font-display → Source Serif 4 (600). Headings, page titles,
.app-header__title. Reads as "document" not "UI label."
--font-mono → unchanged. Platform mono fonts are already excellent
and engineering tools rarely benefit from a custom mono.
Wiring:
- Raw .woff2 files live in shared/fonts/ (~60 KB total, latin subset,
SIL OFL 1.1 — both families)
- shared/fonts.css is base64-inlined data URIs for those three fonts
(~80 KB after b64 overhead). Generated once from the snippet in
shared/fonts/README.md.
- Every tool's build.sh prepends shared/fonts.css before shared/base.css
so @font-face is parsed before any rule references the family names.
- Headings (h1-h6) and .app-header__title now use var(--font-display);
.app-header__title bumped 17→18px and letter-spacing reset since the
serif doesn't need the original sans-text tightening.
- table/code/.tabular-nums get font-variant-numeric: tabular-nums so
tracking-number columns align vertically.
"Ship the record player with the record": zero CDN dependency at render
time. Tools render identically offline and online. Per-tool dist sizes
grew by ~80 KB.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
109 lines
2.8 KiB
Bash
109 lines
2.8 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
root_dir=$(cd "$(dirname "$0")" && pwd)
|
|
. "$root_dir/../shared/build-lib.sh"
|
|
|
|
src_html="$root_dir/template.html"
|
|
output_dir="$root_dir/dist"
|
|
output_html="$output_dir/archive.html"
|
|
|
|
mkdir -p "$output_dir"
|
|
ensure_exists "$src_html"
|
|
|
|
css_temp=$(mktemp)
|
|
js_raw=$(mktemp)
|
|
js_temp=$(mktemp)
|
|
cleanup() { rm -f "$css_temp" "$js_raw" "$js_temp"; }
|
|
trap cleanup EXIT
|
|
|
|
# CSS files to concatenate in order
|
|
concat_files \
|
|
"../shared/fonts.css" \
|
|
"../shared/base.css" \
|
|
"../shared/toast.css" \
|
|
"../shared/nav.css" \
|
|
"../shared/logo.css" \
|
|
"css/base.css" \
|
|
"css/layout.css" \
|
|
"css/components.css" \
|
|
"css/table.css" \
|
|
"css/print.css" \
|
|
> "$css_temp"
|
|
|
|
# JavaScript files to concatenate in order. Vendored libraries first
|
|
# (jszip, docx-preview) so window.JSZip + window.docx are defined before
|
|
# any tool code runs — replaces the previous CDN loadLibrary() calls in
|
|
# table.js + export.js. xlsx is intentionally still CDN-loaded on demand
|
|
# (~900 KB; too large to inline).
|
|
concat_files \
|
|
"../shared/vendor/jszip.min.js" \
|
|
"../shared/vendor/docx-preview.min.js" \
|
|
"../shared/vendor/xlsx.full.min.js" \
|
|
"../shared/vendor/utif.min.js" \
|
|
"../shared/zddc.js" \
|
|
"../shared/hash.js" \
|
|
"../shared/theme.js" \
|
|
"../shared/toast.js" \
|
|
"../shared/nav.js" \
|
|
"../shared/logo.js" \
|
|
"../shared/preview-lib.js" \
|
|
"js/init.js" \
|
|
"js/parser.js" \
|
|
"js/source.js" \
|
|
"js/hash.js" \
|
|
"js/drag-drop.js" \
|
|
"js/directory.js" \
|
|
"../shared/zddc-filter.js" \
|
|
"js/filtering.js" \
|
|
"js/table.js" \
|
|
"js/export.js" \
|
|
"js/presets.js" \
|
|
"js/url-state.js" \
|
|
"js/events.js" \
|
|
"js/app.js" \
|
|
"../shared/help.js" \
|
|
> "$js_raw"
|
|
|
|
# Escape '</' in inlined JS so the HTML parser cannot mistake string contents
|
|
# for a closing </script> tag. Required for any tool with template literals.
|
|
escape_js_close_tags "$js_raw" "$js_temp"
|
|
|
|
compute_build_label "archive" "${1:-}" "${2:-}"
|
|
|
|
# Process template: inject CSS/JS, substitute build label, strip CDN refs.
|
|
awk -v css_file="$css_temp" -v js_file="$js_temp" -v build_label="$build_label" -v is_red="$is_red" -v favicon_uri="$favicon_data_uri" '
|
|
/\{\{CSS_PLACEHOLDER\}\}/ {
|
|
while ((getline line < css_file) > 0) print line
|
|
close(css_file)
|
|
next
|
|
}
|
|
/\{\{JS_PLACEHOLDER\}\}/ {
|
|
while ((getline line < js_file) > 0) print line
|
|
close(js_file)
|
|
next
|
|
}
|
|
/\{\{BUILD_LABEL\}\}/ {
|
|
if (is_red == "1") {
|
|
gsub(/\{\{BUILD_LABEL\}\}/, "<span style=\"color:red;font-weight:bold\">" build_label "</span>")
|
|
} else {
|
|
gsub(/\{\{BUILD_LABEL\}\}/, build_label)
|
|
}
|
|
print
|
|
next
|
|
}
|
|
/\{\{FAVICON\}\}/ {
|
|
gsub(/\{\{FAVICON\}\}/, favicon_uri)
|
|
print
|
|
next
|
|
}
|
|
/<script src="https?:\/\// { next }
|
|
/<link rel="stylesheet" href="https?:\/\// { next }
|
|
{ print }
|
|
' "$src_html" > "$output_html"
|
|
|
|
echo "Wrote $output_html"
|
|
|
|
if [ "$is_release" = "1" ]; then
|
|
promote_release "archive"
|
|
fi
|