kienankb / sitestrap

Dead simple static site generator: JSON & Handlebars

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sitestrap

A dead-simple static site generator created because I wanted templating capabilities (using just the language part of Handlebars) but minimal dependencies. Needs Python 3 and pystache, that's it. For the moment, still pretty rough around the edges, but it works.

After the script's in your $PATH, run sitestrap.py your-site-config-here.json.

Some explanation for the provided example site config:

{
    "outputDir": "output",      // output directory created by the script, won't be overwritten
    "copyDirs": ["assets"],     // a list of directories to recursively just copy to the output dir
    "pages": [
        {
            "template": "base.mustache",    // what template should be rendered?
            "context": "pages/home.json",   // what context should the template be rendered with?
            "outputPath": "index.html"      // where should the resulting output go?
        },
        {
            "template": "base.mustache",
            "context": "pages/test.json",
            "outputPath": "test/index.html"
        },
        ...
    ]
}

Todo list:

  • decent error handling
  • ...or any error handling
  • more robust handling around current working directory/filepaths
  • arg to wipe/overwrite existing output

About

Dead simple static site generator: JSON & Handlebars


Languages

Language:Python 64.9%Language:HTML 28.9%Language:CSS 3.8%Language:JavaScript 2.3%