Skip to content

Static sites

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

On this page

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"
  }
}
utf-8 · pkl · Lines: 11
Terminal
bash
elide build

Fields

PropertyMeaningDefault
srcsSource directory, relative to the project.—
domainProduction domain.—
previewPreview domain; informational.—
prefixMount path for links and assets; must end with /."/"
assetsPublic asset path."<prefix>_/assets"
stylesheetsAdded to every page, besides those in its frontmatter.none
scriptsAdded to every page, besides those in its frontmatter.none
rewriteLinksRewrite relative Markdown links against prefix.true
hosting"workers" or "github-pages"; informational, the build does not publish.—
dependsOnArtifacts to build first.none

Minification and browser targets come from the web block (Web Toolchain). Without image codecs, the build warns once and copies images unchanged.

Samples

Start from a template:

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

Was this page helpful?