Skip to main content

GOV.UK Frontend Jinja Macros

Project description

GOV.UK Frontend Jinja Macros

This repository contains Jinja macro ports of the GOV.UK Frontend. This is currently up to date with release v3.7.0.

How to use

Here is a simple example Flask app that demonstrates how to import and use the GOV.UK Jinja macros.

After running pip install govuk-frontend-jinja, ensure that you tell Jinja where to load the templates from using the PackageLoader as follows:

from flask import Flask
from jinja2 import ChoiceLoader, PackageLoader, PrefixLoader

app = Flask(__name__)

loader = ChoiceLoader([
    PackageLoader('app'),
    PrefixLoader({
        'govuk_frontend_jinja': PackageLoader('govuk_frontend_jinja')
    })
])
app.jinja_loader = loader

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

govuk-frontend-jinja-0.2.0.tar.gz (17.6 kB view hashes)

Uploaded Source

Built Distribution

govuk_frontend_jinja-0.2.0-py3-none-any.whl (30.4 kB view hashes)

Uploaded Python 3

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