Static Site Pipeline
Compile each Markdown page into HTML, then rebuild a shared index from the generated output. This example is small on purpose: it shows `glob`, `foreach`, and a script-backed target without hiding the graph.
Directory Structure
- pages/
- index.md
- about.md
- site/
- Netsukefile
The manifest reads Markdown from pages/, writes HTML into site/, then synthesises an index page from the same sources.
Why it matters
This is the design-doc workflow in miniature: templating resolves first, then Netsuke turns an explicit file graph into Ninja rules.
Annotated Manifest
netsuke_version: "1.0.0"
vars:
pages_dir: pages
site_dir: site
pages:
- about
- contact
rules:
- name: page
command: "pandoc {{ ins }} -o {{ outs }}"
- name: index
command: "pandoc --standalone {{ ins }} -o {{ outs }}"
targets:
- name: "{{ site_dir }}"
command: "mkdir -p {{ outs }}"
- foreach: pages
name: "{{ site_dir }}/{{ item }}.html"
rule: page
sources: "{{ pages_dir }}/{{ item }}.md"
order_only_deps: "{{ site_dir }}"
- name: "{{ site_dir }}/index.html"
rule: index
sources:
- "{{ pages_dir }}/about.md"
- "{{ pages_dir }}/contact.md"
order_only_deps: "{{ site_dir }}"
defaults:
- site/index.html
- site/about.html
- site/contact.html
`foreach` expands the page set
The target list comes from the `pages` variable, so each Markdown file becomes one `.html` output without duplicating the rule block. Discovery with `glob(pages_dir ~ '/*.md')` works too when the page set should track the filesystem.
`order_only_deps` sequences the output directory
Every page target names `{{ site_dir }}` as an order-only dependency: the directory is created first, but touching it never triggers page rebuilds.
Defaults name the deployable artefact
Running `netsuke` with no target builds `site/index.html`, not an abstract package target.
Running the Build
$ netsuke build
[1/4] mkdir -p site
[2/4] pandoc pages/about.md -o site/about.html
[3/4] pandoc pages/contact.md -o site/contact.html
[4/4] pandoc --standalone pages/about.md pages/contact.md -o site/index.html
Build Flow
1. Declare
List the page names once in `vars.pages`.
2. Expand
`foreach` creates one `page` target per entry.
3. Render
Invoke Pandoc for each Markdown page.
4. Assemble
Build `site/index.html` from the source pages with `pandoc --standalone`.