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:
- Building pages โ layouts, partials, front matter, Markdown.
- Images & galleries โ responsive images and a photo grid.
- A documentation site โ the sidebar nav tree, like this site.
- A blog with collections โ posts, sorting, pagination, RSS.
- React components โ pre-render components into pages.
- A complete React static site โ a full hydrated SSG.
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.