# exportStatic

> Documentation for Redweb 0.13.3. Install that exact version when following these examples.

Renders non-live decorated pages to deterministic directory indexes and content-addressed CSS. It is intended for docs, marketing pages, and static hosting.

## Explain it like I’m five

exportStatic is a printing press: give it pages, and it writes finished HTML and assets that any ordinary static host can serve.

## When should I use it?

Use it when you need direct static export without defining a reusable site object and its shared layout policy.

## Follow the example

This API pattern illustrates the named surface; it may require application-owned classes, credentials, or assets. Start from a complete recipe for a runnable application.

```tsx
import path from 'node:path'
import { exportStatic, page } from 'redweb'

@page('/docs', { live: false, css: 'docs.css' })
class DocsPage {
  render() { return '<h1>Redweb docs</h1>' }
}

await exportStatic(DocsPage, {
  outDir: path.resolve('dist'),
  templateRoot: path.resolve('src/pages'),
})
```

1. Page metadata determines output routes and page assets.
2. Every page renders on the server into a staging destination.
3. The returned paths let build tooling audit or publish exactly what was produced.

## Options

- outDir: required output directory; existing unrelated files are preserved
- templateRoot: optional explicit root for templates and CSS
- logger: optional framework logger or null

## Methods and members

### exportStatic(pageOrPages, options)

Returns frozen page and asset path lists after every page renders and its CSS is written.

## What should I watch for?

Export into a staging directory and replace the live build atomically. A failed render should never leave a partially updated site.
