Build a Static Site

This is where Poops stops being "just a bundler." The markup pipeline is a full static site generator: templates, front matter, collections, pagination, an image tag, a search index, a sitemap and a navigation tree โ€” all generated in a single pass.

A typical static-site project looks like this:

my-site/
โ”œโ”€ poops.json
โ”œโ”€ package.json
โ””โ”€ src/
   โ”œโ”€ scss/          โ†’ compiled to dist/css
   โ”œโ”€ js/            โ†’ bundled to dist/js
   โ”œโ”€ static/        โ†’ copied to dist
   โ””โ”€ markup/
      โ”œโ”€ _layouts/   โ†’ base templates (not emitted)
      โ”œโ”€ _partials/  โ†’ includes (not emitted)
      โ”œโ”€ _data/      โ†’ JSON/YAML globals
      โ”œโ”€ index.md
      โ”œโ”€ about.md
      โ””โ”€ blog/
         โ”œโ”€ index.html
         โ””โ”€ first-post.md

A config that ties it together:

{
  "styles": [
    {
      "in": "src/scss/index.scss",
      "out": "dist/css/styles.css",
      "options": { "minify": true }
    }
  ],
  "scripts": [
    {
      "in": "src/js/main.ts",
      "out": "dist/js/scripts.js",
      "options": { "minify": true }
    }
  ],
  "markup": {
    "in": "src/markup",
    "out": "dist",
    "options": {
      "site": {
        "title": "My Site",
        "description": "Built with Poops.",
        "url": "https://example.com"
      },
      "includePaths": ["_layouts", "_partials"],
      "searchIndex": "search-index.json",
      "sitemap": "sitemap.xml",
      "nav": "nav.json"
    }
  },
  "copy": [{ "in": "src/static", "out": "dist" }],
  "serve": { "port": 4040, "base": "/dist" },
  "livereload": true,
  "watch": ["src"]
}

Tip

This very documentation site is built with Poops. The layout, sidebar, search box and code copy buttons you're using right now come out of exactly this pipeline โ€” it's dogfooded.

Work through the pieces:

Info

Poops generates a search index, sitemap and navigation tree automatically when you add searchIndex, sitemap and nav to the markup config. All three come from your pages' front matter in one build pass.