Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (43 sloc) 1.68 KB

Quickstart

Eager to get started? This page gives a good introduction for getting started with staticjinja.

Installation

staticjinja supports Python 2.6, 2.7, 3.3 and 3.4.

Installing staticjinja is simple with pip:

$ pip install staticjinja

Rendering templates

If you're just looking to render simple data-less templates, you can get up and running with the following shortcut:

$ staticjinja build
 Rendering index.html...

This will recursively search ./templates for templates (any file whose name does not start with . or _) and build them to ..

To monitor your source directory for changes, and recompile files if they change, use watch:

$ staticjinja watch
 Rendering index.html...
 Watching 'templates' for changes...
 Press Ctrl+C to stop.

Configuration

build and watch each take 3 options:

  • --srcpath - the directory to look in for templates (defaults to ./templates);
  • --outpath - the directory to place rendered files in (defaults to .);
  • --static - the directory (or directories) within srcpath where static files (such as CSS and JavaScript) are stored. Static files are copied to the output directory without any template compilation, maintaining any directory structure. This defaults to None, meaning no files are considered to be static files. You can pass multiple directories separating them by commas: --static="foo,bar/baz,lorem".

More advanced configuration can be done using the staticjinja API, see :ref:`custom-build-scripts` for details.