# tui-pages website
Static marketing site for the [`tui-pages`](https://gitlab.com/filipriec/tui-pages) Rust crate.
No build step required — open `index.html` in a browser and you're done.
## Stack
| Layer | Tech | Source |
| --- | --- | --- |
| HTML | Hand-written semantic | `*.html` |
| CSS framework | Tailwind CSS v3 (Play CDN) | runtime |
| Components | DaisyUI v4 (prebuilt CSS) | runtime |
| Interactivity | HTMX 2 | runtime |
| Light JS | Alpine.js 3 | runtime |
| Code highlight | highlight.js 11 (Rust, TOML, Bash) | runtime |
| Fonts | Inter + JetBrains Mono (Google Fonts) | runtime |
| Icons | Lucide (inline SVG) | hand-written |
| Page transitions | View Transitions API (native) | n/a |
Everything is loaded from public CDNs. The only thing served from this repo is
the HTML, our small `static/css/site.css` layer, and the SVG assets in
`static/img/`.
## Local development
```bash
# Just open the file
xdg-open index.html # Linux
open index.html # macOS
# Or serve it (recommended — gives you a stable URL for htmx)
python3 -m http.server 8000
# then visit http://localhost:8000
```
The `Makefile` wraps the Python server and a few convenience commands:
```bash
make serve # python3 -m http.server 8000
make size # report file sizes
make validate # quick HTML syntax check (search for unclosed tags)
make tidy # run html-tidy on every .html (warnings only)
make ascii # regenerate the body-rain ASCII art (needs `chafa`)
```
## Animated ASCII body background
The page background is **animated ASCII art** generated by
[`chafa`](https://github.com/hpjansson/chafa) from a stripped-down version
of the Open Graph card (`static/img/og-image-bg.svg` — black background,
grid, the `tui-pages` wordmark, the "A framework for / building TUIs in
Rust." headline, and the subtitle, with the install button cropped out
because chafa was rendering it as a row of `@` symbols). The art is plain
text inside `
` blocks; the animation is pure CSS.
```
static/ascii/rain.txt ← 240 × ~50 grid of og-image-bg.svg
```
To re-render after changing the source SVG (you need `chafa` on `$PATH`,
or run inside `nix develop`):
```bash
make ascii
```
The source SVG is committed (`static/img/og-image-bg.svg`) so `make ascii`
is fully reproducible — no ImageMagick, no cropping step.
### How it's wired
- A single `` is placed at
the top of ``, fixed full-bleed, with `z-index: -1` and
`pointer-events: none` so it never blocks the UI.
- Inside, a `
` holds **two byte-identical
copies** of the chafa output stacked vertically for a seamless
`translateY(0 → -50%)` loop over 90 s.
- Color is `#f4a26b` (warm rust-orange) at 14% opacity with a faint
`text-shadow` glow — picks up the brand colour and reads as a subtle
background, not a wall of `@` blocks.
- A `::after` overlay draws a 2 px CRT scanline pattern that ticks
downward at 8 s/cycle.
- The hero section has a `.tp-ascii-hero-overlay` class that paints a
vertical gradient over the top of the page, so the hero text stays
readable while the ASCII art shows through on the bottom half and below.
- The light theme inverts to dark text on light, dimmer, no glow.
- All animations are disabled inside
`@media (prefers-reduced-motion: reduce)`.
The hero (`#hero`) is **not** animated — it keeps the original static
`static/img/terminal-default.svg` mockup, exactly as designed.
## Nix (optional, recommended)
A `flake.nix` is included that ships a reproducible dev shell, a buildable
package, a `serve` app, and an `html-tidy` check. You do **not** need Nix to
use this project — it's a convenience.
```bash
# Enter the dev shell (gives you: gnumake, python3, asciinema, html-tidy, …)
nix develop
# Build the whole site → ./result/ (16 files, ~150 kB, ready to upload)
nix build
ls result/
# Build + serve on http://localhost:8000 (or $PORT)
nix run .#serve
# Validate the HTML, format the flake
nix flake check
nix fmt
```
### What the flake provides
| Output | Command | What it does |
| --- | --- | --- |
| `packages..default` | `nix build` | Assembles the static site into a single derivation |
| `apps..serve` | `nix run .#serve` | Builds the package, then `python3 -m http.server` it |
| `devShells..default` | `nix develop` | Shell with `make`, `python3`, `asciinema`, `tidy`, `curl` |
| `checks..tidy` | `nix flake check` | Runs `html-tidy` over every `.html` in the built site |
| `formatter.` | `nix fmt` | `nixpkgs-fmt` for the flake itself |
### Why no Rust toolchain?
The crate lives in `../komp_ac/tui-pages/`. This repo only contains the
*static* website, so the flake intentionally omits `rust-overlay` and a
`rustPlatform` — they would add hundreds of MB to the shell closure for
nothing. When the site eventually gains a Rust backend, those inputs come
back.
### Why the per-system pattern?
Mirrored from the upstream Codex CLI flake so future contributors see a
shape they already recognise. `forAllSystems` is a one-liner that
guarantees `linux`/`darwin` × `x86_64`/`aarch64` parity without sprinkling
`if` branches across the file.
## Going to production
The CDN approach is fine for marketing pages. For better performance
(smaller CSS, no runtime Tailwind compile), swap the Play CDN for the
**Tailwind standalone CLI**:
```bash
# 1. Download the standalone CLI
# https://tailwindcss.com/blog/standalone-cli
# 2. Put the binary in ./bin/tailwindcss
# 3. Create src/site.css that imports Tailwind and DaisyUI:
# @import "tailwindcss";
# @plugin "daisyui";
# 4. Build
./bin/tailwindcss -i src/site.css -o static/css/site.css --minify
```
Then in `index.html` remove the Tailwind Play CDN `
```
The body-rain ASCII art is independent of the hero and stays as-is.
## License
The website source is MIT-licensed. The terminal mockup SVGs in `static/img/`
are hand-drawn and original. The crate itself is at
.