# nucleic-site

Cloudflare Worker that serves Nucleic's static teaser site on **`nucleic.blakeslee.xyz`**.

It's an [assets-only Worker](https://developers.cloudflare.com/workers/static-assets/) — there is
no `main` script. The pages live at repo-root [`website/`](../../website/) (the source of truth per
`NUCLEIC_CONCEPT.md`) and are kept human-readable there.

## Build (minify)

`npm run build` runs [`build.mjs`](./build.mjs), which minifies every text asset in `website/` into
`dist/` and copies binaries (fonts, images, `_headers`) verbatim:

- **HTML** — `html-minifier-terser`, including inline `<style>` and `<script>` blocks
- **CSS** / **JS** — `clean-css` / `terser` (for any standalone files)

`wrangler.jsonc` points `assets.directory` at `dist/`, so deploys serve the minified output.
`dist/` is generated and git-ignored — never edit it; edit `website/` and rebuild.

The `dev`, `check`, and `deploy` scripts all run `build` first, so you never deploy stale or
unminified assets.

## Develop

```sh
npm install
npm run build     # minify website/ → dist/
npm run check     # build + wrangler deploy --dry-run — bundles assets, no upload, no auth
npm run dev       # build + local server at http://localhost:8787
```

## Deploy

Deploying needs Cloudflare auth (`wrangler login`, browser OAuth) **or** a `CLOUDFLARE_API_TOKEN`
env var with Workers Scripts + Workers Routes edit on the `blakeslee.xyz` zone.

```sh
npm install
wrangler login        # one-time, interactive (skip if CLOUDFLARE_API_TOKEN is set)
npm run deploy
```

On first deploy, wrangler provisions the `nucleic.blakeslee.xyz` DNS record and TLS cert
automatically (the `routes` custom domain). The `blakeslee.xyz` zone must be on the account — it
already is; `nucleic-edge` serves `api.` / `relay.` on the same zone.

To publish edits later, just change the files in `website/` and re-run `npm run deploy` — it
rebuilds `dist/` (minifying) before uploading.
