Skip to main content

A simple static file generator based off of the Jinja templating language.

Project description

Jinja2Static

Jinja2Static is a minimal, developer-friendly toolchain that builds static sites from Jinja2 templates and simple project configurations. It provides three CLI subcommands to scaffold a project, run a development server with live rebuilds, and produce a static output directory for deployment.

Key features

  • Scaffolds a small project layout to get started quickly.
  • Runs a local development server that watches files and rebuilds on change.
  • Builds a static site by rendering Jinja2 templates and copying asset files.

Install

Install from PyPI:

pip install jinja2static

Typical workflow

  1. Create a project scaffold:
jinja2static init mysite
cd mysite
  1. Work locally with live reload:
jinja2static dev
  1. Produce a production-ready static site:
jinja2static build

Project configuration

jinja2static reads project configuration from the provided path or the current working directory. You can pass either a directory or a pyproject.toml file as project_file_path to target a specific project. See the example pyproject.toml in the init scaffold for configurable options (templates directory, asset locations, and output dist directory).

Quick CLI Guide

All subcommands accept an optional project_file_path argument (a directory or a pyproject.toml file). They also accept -v/--verbose to enable more logging.

  • init — initialize a new jinja2static project scaffold.

    • Usage: jinja2static init [project_file_path]
    • Example: jinja2static init mysite creates a new mysite scaffold with templates, assets, and example data.
  • dev — run a development server that watches source files and rebuilds on change.

    • Usage: jinja2static dev [project_file_path] [-p PORT]
    • Options: -p/--port (default 8000) to choose the server port.
    • Example: jinja2static dev -p 8080 starts the server on port 8080 and serves the generated site while watching for changes.
  • build — render your project to a static output directory for deployment.

    • Usage: jinja2static build [project_file_path]
    • Example: jinja2static build compiles templates, copies assets, and writes the static site to the configured dist folder.

Logging & verbosity

Add -v or --verbose to any command to enable more detailed logging useful for debugging builds and the development server.

Contributing

Contributions are welcome. See the source under the src/jinja2static package for implementation details and tests in tests/.


Happy templating! If you want examples tailored to your project layout, open an issue or ask for help.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jinja2static-1.0.1.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jinja2static-1.0.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file jinja2static-1.0.1.tar.gz.

File metadata

  • Download URL: jinja2static-1.0.1.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for jinja2static-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f4c8c24000ea6248875eeb941a9d58423859ff675ed4ac58eb2e56653cedd77c
MD5 696451a4caf26ce55cd32bed6929dcb6
BLAKE2b-256 ea3cc554c37f59f6bebeed75c19dbcb1fee3b1fcf12d805ca5e28e95e0f31cc8

See more details on using hashes here.

File details

Details for the file jinja2static-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: jinja2static-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for jinja2static-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fc4e603fc7a83f995bad1fec7b3af54e845f9856ddc13c97d971d27be55dd698
MD5 526cdcc25e72c52633e39f4a81fb8907
BLAKE2b-256 ab68f82a12d943be8bb7f56082695f7c4b8d00142756f96f82b163ce61a1e421

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page