# Static sites

> Build a static site with Elide's StaticSite artifact: render Markdown, process scripts and stylesheets, compress images and copy other files.

A `StaticSite` artifact renders Markdown, processes scripts and stylesheets, compresses images and copies everything
else.

```pkl
amends "elide:project.pkl"
import "elide:Web.pkl" as Web

artifacts {
  ["site"] = new Web.StaticSite {
    srcs = "site"
    domain = "example.com"
    stylesheets { "site/theme.css" }
    hosting = "github-pages"
  }
}
```

```bash
elide build
```

## Fields

| Property | Meaning | Default |
| --- | --- | --- |
| `srcs` | Source directory, relative to the project. | — |
| `domain` | Production domain. | — |
| `preview` | Preview domain; informational. | — |
| `prefix` | Mount path for links and assets; must end with `/`. | `"/"` |
| `assets` | Public asset path. | `"<prefix>_/assets"` |
| `stylesheets` | Added to every page, besides those in its frontmatter. | none |
| `scripts` | Added to every page, besides those in its frontmatter. | none |
| `rewriteLinks` | Rewrite relative Markdown links against `prefix`. | `true` |
| `hosting` | `"workers"` or `"github-pages"`; informational, the build does not publish. | — |
| `dependsOn` | Artifacts to build first. | none |

Minification and browser targets come from the `web` block ([Web Toolchain](https://elide.help/docs/toolchain/web#manifest-settings)).
Without image codecs, the build warns once and copies images unchanged.

## Samples

Start from a template:

```bash
elide init --template web-simple  # static site
elide init --template web-demo    # static site with TypeScript and Markdown
```
