Skip to main content

No project description provided

Project description

Jinja2 SSG

A very simple static site generator.

  • The filesystem structure in --src is copied into --dest.
  • Files and folders starting with _ are skipped.
  • By default only html, txt, js files are used and the rest of them are skipped.
  • YAML files can be used to provide data inside templates.
python3 -m pip install jinja2ssg
python3 -m jinja2ssg --src src --dest publish build

Example

site/src/
├── _base.html
├── _social_links.yaml
├── donate
│   └── index.html
├── _footer.html
├── index.html
└── _nav.html

Results in a DEST structure like:

site/www/
├── index.html
└── donate
    └── index.html

Common patterns

  • Run with inotify to rebuild on source file changes.
        inotifywait --recursive --monitor --format "%e %w%f" \
        --event modify,move,create,delete ./src \
        | while read changed; do
            echo $changed
            (python3 -m jinja2ssg build)
        done
    
  • Put social links inside _social.yaml files and access as {{ yaml._social.facebook }}
  • Access all build paths using {{ build_paths }}. Useful while writing service worker code to cache the site as a PWA.
  • Access {{ relative_path }} to know the path of the current file being rendered.

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

jinja2ssg-0.1.11.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

jinja2ssg-0.1.11-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file jinja2ssg-0.1.11.tar.gz.

File metadata

  • Download URL: jinja2ssg-0.1.11.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.4 Linux/6.2.0-36-generic

File hashes

Hashes for jinja2ssg-0.1.11.tar.gz
Algorithm Hash digest
SHA256 2ba80d31296d13aba5ff7687cf729794644862a0930855bc2b911ba8d5120d97
MD5 7542b521ef6f641753d3bbf6ed0a5a51
BLAKE2b-256 059d74c9cbc3b61e9a65db6747c4f698e9efc2db1f8348e009f74496309df2ed

See more details on using hashes here.

File details

Details for the file jinja2ssg-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: jinja2ssg-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.4 Linux/6.2.0-36-generic

File hashes

Hashes for jinja2ssg-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 9ea89df494f8f01ef5b5aa9f4da2641c8e27501a6d7845ad4cf72b612a206e33
MD5 07d213b9ade1c463389fe1ad28dd6cd7
BLAKE2b-256 01816d4d2e805653937d00af9c10bc733815666612bcf5fa2b92bb7edfe9506b

See more details on using hashes here.

Supported by

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