Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from matthew-shaw/govuk-frontend
Browse files Browse the repository at this point in the history
GOV.UK Frontend
  • Loading branch information
matthew-shaw authored Jun 25, 2020
2 parents 6a555d2 + d96e36a commit 92e58e1
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Created by https://www.toptal.com/developers/gitignore/api/python,flask
# Edit at https://www.toptal.com/developers/gitignore?templates=python,flask

### GOV.UK Frontend ###
app/static*

### Flask ###
instance/*
!instance/.gitignore
Expand Down
6 changes: 5 additions & 1 deletion CHANGEOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/matthew-shaw/govuk-frontend-jinja-example/compare/0.2.0...master)
## [Unreleased](https://github.com/matthew-shaw/govuk-frontend-jinja-example/compare/0.3.0...master)

## [0.3.0](https://github.com/matthew-shaw/govuk-frontend-jinja-example/releases/tag/0.3.0) - 25/06/2020

### Added

- Script to pull down [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend/) to the app's `static` directory
- Set asset paths to get static CSS, JS and image content
- `Procfile` and `gunicorn` requirements to deploy to Heroku

## [0.2.0](https://github.com/matthew-shaw/govuk-frontend-jinja-example/releases/tag/0.2.0) - 18/06/2020
Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: gunicorn app:app --log-file -
web: ./build.sh; gunicorn app:app --log-file -
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from flask import Flask
from jinja2 import ChoiceLoader, PackageLoader, PrefixLoader

app = Flask(__name__)
app = Flask(__name__, static_url_path='/assets')

app.jinja_loader = ChoiceLoader([
PackageLoader('app'),
Expand Down
14 changes: 14 additions & 0 deletions app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@
{%- from 'govuk_frontend_jinja/components/accordion/macro.html' import govukAccordion -%}
{%- from 'govuk_frontend_jinja/components/tag/macro.html' import govukTag -%}

{% set assetPath = url_for('static', filename='').rstrip('/') %}

{% block head %}
<!--[if gt IE 8]><!--><link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='govuk-frontend-3.7.0.min.css') }}" /><!--<![endif]-->
<!--[if IE 8]><link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='govuk-frontend-ie8-3.7.0.min.css') }}" /><![endif]-->
{% endblock %}

{% block bodyEnd %}
<!--[if gt IE 8]><!-->
<script src="{{ url_for('static', filename='govuk-frontend-3.7.0.min.js') }}"> </script>
<script>window.GOVUKFrontend.initAll()</script>
<!--<![endif]-->
{% endblock %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
6 changes: 6 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
curl -L https://github.com/alphagov/govuk-frontend/releases/download/v3.7.0/release-v3.7.0.zip > govuk_frontend.zip
rm -rf app/static
unzip -o govuk_frontend.zip -d app/static
mv app/static/assets/* app/static
rm -rf app/static/assets
rm -rf govuk_frontend.zip
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
exclude = venv
max-line-length = 120

0 comments on commit 92e58e1

Please sign in to comment.