StaticSite Github

StaticSite

An stupidly simple static site builder using Jinja2. This current documentation is built using staticsite itself.

Refer to the code or open an issue if something is unclear.

  1. Create a src directory.
  2. Create your source files in that directory.
  3. Run python -m staticsite build --target docs to build your site into the docs directory.
  4. Serve your site with cd docs && python -m http.server at http://localhost:8000

Usage

$ mkdir src
$ vim src/.base.html
$ vim src/index.html
$ python -m staticsite build --target docs

Note:Files with a leading . are not rendered into the final site.

Note:A .sitehash.txt file is added to the final results denoting a hash for the build.

.
├── src
│   ├── .autoreload.html
│   ├── .base.html
│   ├── css
│   │   └── .base.css
│   ├── .examples.html
│   └── index.html
│
└── docs
    ├── index.html
    └── .sitehash.txt

Examples

See examples folder for ways to do modern things with staticsite.

Developing the site

python -m staticsite watch keeps re-rendering your site as soon as it detects changes.

You can then use {% include '.autoreload.html' %} in your site's base tempate, which will reload your site in the browser when the source files change.

If you build your site using pyton -m staticsite build then the auto reload part is not included, leaving you with a static site.

Adding custom processors

You can add custom processors by adding them as key, value pairs in your staticsite yml file. For example the example file contains pretty_json. which renders like:
{
  "a": {
    "b": {
      "c": {
        "d": 10
      }
    }
  }
}