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

ScriptCommandDescription
bun devconc -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 previewbun scripts/preview.tsServe 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:

  1. bun prepare:images - generates responsive image variants; runs non-blocking so the server starts instantly (near-instant on warm runs)
  2. bun css:watch - the Tailwind CSS watcher, recompiling on every file change
  3. bun 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

ScriptCommandDescription
bun prepare:imagesbun scripts/prepare_images.tsGenerate responsive image variants from assets/images/ (see below)
bun ssgbun prepare:images && bun css:build && bun scripts/ssg.ts … && bun sitemap && bun rssFull 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.

FlagDefaultDescription
--widths <list>from config/responsive_imagesComma-separated width breakpoints
--quality <n>from config/responsive_imagesQuality for both formats (1-100)
--quality-webp <n> / --quality-jpeg <n>80 / 80Per-format quality
--forceoffRe-encode even if outputs exist

SSG Options

All SSG scripts accept these options via command-line flags:

bun scripts/ssg.ts [options]
FlagDefaultDescription
--public <dir>./src/publicSource directory with .ree templates
--dist <dir>./distOutput directory for static HTML
--base-url <url>/Base URL for the site
--site-url <url>emptyFull site URL for hreflang links
--verboseoffLog 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

ScriptCommandDescription
bun css:buildtailwindcss -i ./src/css/style.css -o ./src/public/css/style.min.css --minifyOne-time CSS build (minified), output to src/public/css/style.min.css
bun css:watchtailwindcss -i ./src/css/style.css -o ./src/public/css/style.min.css --minify --watchWatch 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

ScriptCommandDescription
bun sitemapbun scripts/generate_sitemap.ts --public ./src/public --dist ./distGenerate sitemap.xml
bun rssbun scripts/generate_rss.ts --public ./src/public --dist ./distGenerate 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]
OptionDefaultDescription
--public <dir>./src/publicSource directory with page templates
--dist <dir>./distOutput 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]
OptionDefaultDescription
--public <dir>./src/publicSource directory
--dist <dir>./distOutput directory
--site-url <url>$SITE_URL (required)Absolute origin
--blog-dir <name>$BLOG_DIR (required)Sub-directory under --public to scan
--formats <list>xml,jsonComma list: xml, json, or both
--max-items <n>50Limit 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

ScriptCommandDescription
bun reeweb:installbun scripts/install.tsPrepare 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

ScriptCommandDescription
bun formatreettierFormat 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"
    }
}