A version of the design system implemented as HTML Templates components is currently under development.
These are idiomatic components suitable for applications developed with Nunjucks
or Jinja.
Note that the HTML components are currently under design review. Component designs and implementations will change over time, but any breaking changes will be handled with major version increments.
We are also reviewing mechanisms to abstract away the underlying HTML markup when consuming components to simplify updates as components change.
Please check the current status of each HTML component for latest updates.
You can install the Gov IE Frontend global HTML components by copying the CSS, JavaScript, and macro files into your project.
govie-frontend.zip
asset file from the latest release of @govie-ds/html
.theme.zip
asset file from the latest release of @govie-ds/theme-govie
.theme.css
file from theme.zip
to a folder that can serve static CSS files, e.g. static/css
.styles.css
file from govie-frontend.zip
to a folder that can serve static CSS files, e.g. static/css
.govie-frontend.umd.js
file from govie-frontend.zip
to a folder that can serve static JavaScript files, e.g. static/js
.macros
folder from govie-frontend.zip
file to a location that can be configured with Jinja.The
macros
folder contains bothdev
andprod
versions of Jinja macros. You should configure Wagtail to use thedev
macros in non-prod environments, and theprod
macros in production.
from django.templatetags.static import static from jinja2 import Environment def environment(**options): env = Environment(**options) env.globals.update({ 'static': static, }) return env
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
os.path.join(PROJECT_DIR, "templates"),
],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
{
'BACKEND': 'django.template.backends.jinja2.Jinja2',
'APP_DIRS': True,
"DIRS": [
os.path.join(PROJECT_DIR, "jinja"),
os.path.join(PROJECT_DIR, "macros/jinja/dev"),
],
'OPTIONS': {
'extensions': [
'wagtail.jinja2tags.core',
'wagtail.admin.jinja2tags.userbar',
'wagtail.images.jinja2tags.images',
],
'environment': 'core.jinja2-env.environment',
},
}
]
Specify the appropriate folder paths to your application Jinja templates, the Gov IE Frontend global HTML macros, and your Jinja environment file for serving static assets.
{% from 'govie/header/macro.html' import govieHeader %} <!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>{{ page.title }}</title> <link rel="stylesheet" href="{{ static('css/theme.css') }}" /> <link rel="stylesheet" href="{{ static('css/styles.css') }}" /> </head> <body> {{ govieHeader({ 'title': 'Application title' }) }} <h1>{{ page.title }}</h1> <script src="{{ static('js/govie-frontend.umd.js') }}"></script> </body> </html>
Note that the template needs to include the
theme.css
,styles.css
, andgovie-frontend.umd.js
files previously copied to a folder that can serve static files.