Overview

staticjinja

Script to easily deploy static sites using the extremely handy jinja2 templating language.

Rationale

If you are deploying a static website that could benefit from factoring out data or modularizing html pages (especially convenient when prototyping) then you are going to want to use a templating engine of some sort. jinja2 is an extremely powerful tool in this regard.

This project takes away the pain of managing the jinja API and lets you focus on just deploying a site.

Requirements

pip install requirements.txt

  • jinja2 (pip install jinja2)
  • hamlish-jinja for haml support
  • (optional, for automatic compilation) watchdog (pip install watchdog)

Setup

To compile the templates run python build.py. This will look execute the main function in build.py (looks for every file inside ./templates not starting with _).

For pages which require a context of some sort, you will need to write a custom function that main calls, passing context data as extra arguments to build_template.

Automatic Compilation

If you installed watchdog, you can run 'python build.py --watch' to automatically recompile templates whenever a change is made.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.