Scripts Reference
Introduction
ReeWeb's package.json defines a set of scripts for static site generation, development, and maintenance. This page lists every script with its exact command and purpose.
Development Scripts
| Script | Command | Description |
|---|---|---|
bun dev | conc -n img,tw,dev -c magenta,yellow,blue "bun prepare:images" "bun css:watch" "bun development" | Generate responsive images, then run the CSS watcher and dev server concurrently, with colour-coded output |
bun preview | bun scripts/preview.ts | Serve the generated dist/ output locally to verify the production site |
How bun dev Works
bun dev uses conc (the concurrently package) to start three processes in parallel:
bun prepare:images- generates responsive image variants; runs non-blocking so the server starts instantly (near-instant on warm runs)bun css:watch- the Tailwind CSS watcher, recompiling on every file changebun development- the dev server (scripts/dev.ts), serving templates with live reload
All three run in the same terminal with colour-coded prefixes so their output is easy to distinguish. Open http://localhost:3000 once they are running.
The dev server is documented in detail on the Dev Server page.
SSG Scripts
| Script | Command | Description |
|---|---|---|
bun prepare:images | bun scripts/prepare_images.ts | Generate responsive image variants from assets/images/ (see below) |
bun ssg | bun prepare:images && bun css:build && bun scripts/ssg.ts … && bun sitemap && bun rss | Full production SSG with fresh images, built CSS, sitemap, and RSS feed |
Responsive Images (prepare:images)
scripts/prepare_images.ts turns full-size originals in assets/images/ into
width-stepped WebP + JPEG variants in src/public/images/responsive/
(git-ignored), using Bun's native Bun.Image - no external dependency. It runs
before bun ssg (blocking) and concurrently inside dev
(non-blocking, so the server starts instantly), and is incremental (mtime-based):
warm runs are near-instant, and editing one original rebuilds only that image.
Widths and quality live in config/responsive_images.ts. See the
Responsive Images recipe for detail.
| Flag | Default | Description |
|---|---|---|
--widths <list> | from config/responsive_images | Comma-separated width breakpoints |
--quality <n> | from config/responsive_images | Quality for both formats (1-100) |
--quality-webp <n> / --quality-jpeg <n> | 80 / 80 | Per-format quality |
--force | off | Re-encode even if outputs exist |
SSG Options
All SSG scripts accept these options via command-line flags:
bun scripts/ssg.ts [options]
| Flag | Default | Description |
|---|---|---|
--public <dir> | ./src/public | Source directory with .ree templates |
--dist <dir> | ./dist | Output directory for static HTML |
--base-url <url> | / | Base URL for the site |
--site-url <url> | empty | Full site URL for hreflang links |
--verbose | off | Log each rendered file |
Pass --verbose directly for verbose output:
bun scripts/ssg.ts --public ./src/public --dist ./dist --verbose
The SSG pipeline is documented on the SSG Pipeline page.
CSS Scripts
| Script | Command | Description |
|---|---|---|
bun css:build | tailwindcss -i ./src/css/style.css -o ./src/public/css/style.min.css --minify | One-time CSS build (minified), output to src/public/css/style.min.css |
bun css:watch | tailwindcss -i ./src/css/style.css -o ./src/public/css/style.min.css --minify --watch | Watch mode - recompiles on every file change, same output path |
Note: bun ssg includes the CSS build, image preparation, sitemap generation, and RSS generation for a complete production-ready generation pass.
The Tailwind setup is documented on the Tailwind CSS Setup page.
SEO Scripts
| Script | Command | Description |
|---|---|---|
bun sitemap | bun scripts/generate_sitemap.ts --public ./src/public --dist ./dist | Generate sitemap.xml |
bun rss | bun scripts/generate_rss.ts --public ./src/public --dist ./dist | Generate RSS/JSON feeds from blog markdown |
Both should be run after bun ssg - they read from the generated dist/ directory. Neither command hardcodes a site URL; they read the absolute origin from the SITE_URL environment variable (see Configuration), so set SITE_URL in .env or the SSG environment before running them.
Sitemap Options
bun scripts/generate_sitemap.ts [options]
| Option | Default | Description |
|---|---|---|
--public <dir> | ./src/public | Source directory with page templates |
--dist <dir> | ./dist | Output directory (sitemap.xml is written here) |
--site-url <url> | $SITE_URL (required) | Absolute origin for <loc> and hreflang |
--help | - | Print usage and exit |
See the Sitemap Generator page for per-page frontmatter options.
RSS Options
bun scripts/generate_rss.ts [options]
| Option | Default | Description |
|---|---|---|
--public <dir> | ./src/public | Source directory |
--dist <dir> | ./dist | Output directory |
--site-url <url> | $SITE_URL (required) | Absolute origin |
--blog-dir <name> | $BLOG_DIR (required) | Sub-directory under --public to scan |
--formats <list> | xml,json | Comma list: xml, json, or both |
--max-items <n> | 50 | Limit items per feed |
--feed-title <text> | - | Override the feed title |
--feed-description <text> | - | Override the feed description |
--help | - | Print usage and exit |
See the RSS Generator page for per-post frontmatter options.
Installation
| Script | Command | Description |
|---|---|---|
bun reeweb:install | bun scripts/install.ts | Prepare an extracted ReeWeb project in the current directory |
The install task initialises Git, creates .env from .env.example when needed, runs bun install, installs the conc development runner, and fetches ReeWeb's formatter and vendor assets. bun dev and bun ssg prepare images and build CSS when they run.
Formatting
| Script | Command | Description |
|---|---|---|
bun format | reettier | Format all source files with reettier |
package.json Reference
The scripts above are defined in package.json under the "scripts" key. You can add your own scripts at any time - there's no ReeWeb-specific structure to follow:
{
"scripts": {
"dev": "conc -n img,tw,dev -c magenta,yellow,blue \"bun prepare:images\" \"bun css:watch\" \"bun development\"",
"development": "bun --hot --no-clear-screen scripts/dev.ts",
"prepare:images": "bun scripts/prepare_images.ts",
"css:build": "tailwindcss -i ./src/css/style.css -o ./src/public/css/style.css --minify",
"css:watch": "tailwindcss -i ./src/css/style.css -o ./src/public/css/style.css --watch --verbose",
"ssg": "bun prepare:images && bun css:build && bun scripts/ssg.ts --public ./src/public --dist ./dist && bun sitemap && bun rss",
"rss": "bun scripts/generate_rss.ts --public ./src/public --dist ./dist",
"sitemap": "bun scripts/generate_sitemap.ts --public ./src/public --dist ./dist",
"format": "reettier",
"preview": "bun scripts/preview.ts",
"get:conc": "bun add -g concurrently@10.0.3",
"get:pre": "bun get:zod && bun get:hljs && bun get:conc && bun get:reettier && bun get:reesql",
"reeweb:install": "bun scripts/install.ts && bun get:pre"
}
}