GOV.UK Frontend Jinja Macros
Project description
GOV.UK Frontend Jinja Macros
This is a GOV.UK Design System Community Resource, created and maintained by HM Land Registry
This repository provides a complete set of Jinja macro ports that are kept up-to-date and 100% compliant with the GOV.UK Frontend Nunjucks macros. Porting is intentionally manual rather than automated to make updates simpler than maintaining an automated conversion routine. A comprehensive test suite ensures compliance against the latest, and every subsequent, GOV.UK Frontend release.
- Package: https://pypi.org/project/govuk-frontend-jinja/
- Demo app: https://github.com/LandRegistry/govuk-frontend-jinja-demo
- Live demo: https://govuk-frontend-jinja.herokuapp.com/
How to use
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__)
app.jinja_loader = ChoiceLoader(
[
PackageLoader("app"),
PrefixLoader({"govuk_frontend_jinja": PackageLoader("govuk_frontend_jinja")}),
]
)
Running the tests
The tests are run in a GitHub actions pipeline but if you want to run them locally you will need to install govuk-frontend-diff.
There is a test server at tests/utils/app.py
which you will need to run using the following command:
(cd tests/utils && python -m flask run --port 3000)
You can then run the tests using govuk-frontend-diff
as follows:
./govuk-frontend-diff http://localhost:3000 --govuk-frontend-version=v3.12.0
This is all wrapped up in ./test.sh
for simplified running (Requires Docker).
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
How to contribute
We welcome contribution from the community. If you want to contribute to this project, please review the code of conduct and contribution guidelines.
Contributors
- Matt Shaw (Primary maintainer)
- Andy Mantell (Original author)
Support
This software is provided "as-is" without warranty. Support is provided on a "best endeavours" basis by the maintainers and open source community.
If you are a civil servant you can sign up to the UK Government Digital Slack workspace to contact the maintainers listed above and the community of people using this project in the #govuk-design-system channel.
Otherwise, please see the contribution guidelines for how to raise a bug report or feature request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for govuk-frontend-jinja-1.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9dffbfa341244a97dbad837ea14bf60e62d5ec4b46f1d6fe1c5523c37d394a6 |
|
MD5 | e049dbf9f8649b0c009643adf8bc62b6 |
|
BLAKE2b-256 | cf7b899ec40706a7192558007f6bdd2957f07ec561fbcade3c21870d68b19fa5 |
Hashes for govuk_frontend_jinja-1.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0209d827b2f7df0789ba73011406f9ca6bfd72a112a061cf8fdfb66146377595 |
|
MD5 | 21ff0126336d671e87ebb80c2e2374ac |
|
BLAKE2b-256 | 8cbdbc098ddb67bf16eb23ccc42641a3ceeaf02ab86358f24a71b8e3e2e4bec5 |