Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add GOV.UK Frontend boilerplate template #288

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/metalsmith.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const views = [
paths.layouts,
paths.partials,
paths.components,
paths.govukfrontendcomponents
paths.govukfrontendcomponents,
paths.govukfrontend
]

// static site generator
Expand Down
2 changes: 1 addition & 1 deletion src/stylesheets/components/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// removing this affects the positioning of the underline and causes other
// issues with the display of the focus style in IE8-11.

@include govuk-exports("header") {
@include govuk-exports("app-header") {

.app-header {
padding: $govuk-spacing-scale-2 $govuk-spacing-scale-3;
Expand Down
79 changes: 43 additions & 36 deletions views/layouts/_generic.njk
Original file line number Diff line number Diff line change
@@ -1,39 +1,46 @@
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ title }}</title>
<!--[if !IE 8]><!-->
<link href="/{{ fingerprint['stylesheets/main.css'] }}" rel="stylesheet" media="all" />
<!--<![endif]-->
<!--[if lt IE 9]>
<link href="/{{ fingerprint['stylesheets/main-ie8.css'] }}" rel="stylesheet" media="all" />
<script src="/{{ fingerprint['javascripts/ie.js'] }}"></script>
<![endif]-->
<script src="/javascripts/vendor/modernizr.js"></script>
{% include "_tracking-head.njk" %}
</head>
<body>
{% include "_tracking-body.njk" %}
<a href="#content" class="govuk-skip-link">Skip to main content</a>
<div class="app-pane">
{% include "_cookie-banner.njk" %}
<div class="app-pane__header">
{% include "_header.njk" %}
{% include "_banner.njk" %}
</div>
<div class="app-pane__nav">
{% include "_navigation.njk" %}
{% include "_mobile-navigation.njk" %}
</div>
{% extends "template.njk" %}

{% block body %}
{{ contents | safe }}
{% endblock %}
{% block pageTitle %}{{ title }}{% endblock %}

{% block head %}
<meta name="robots" content="noindex, nofollow">
<!--[if !IE 8]><!-->
<link href="/{{ fingerprint['stylesheets/main.css'] }}" rel="stylesheet" media="all" />
<!--<![endif]-->
<!--[if lt IE 9]>
<link href="/{{ fingerprint['stylesheets/main-ie8.css'] }}" rel="stylesheet" media="all" />
<script src="/{{ fingerprint['javascripts/ie.js'] }}"></script>
<![endif]-->
<script src="/javascripts/vendor/modernizr.js"></script>
{% include "_tracking-head.njk" %}
{% endblock %}

{% block bodyStart %}
{% include "_tracking-body.njk" %}
{% endblock %}

{# Hide default header and footer, since we wrap it. #}
{% block footer %}{% endblock %}
{% block header %}{% endblock %}

{% block main %}
<div class="app-pane">
{% include "_cookie-banner.njk" %}
<div class="app-pane__header">
{% include "_header.njk" %}
{% include "_banner.njk" %}
</div>
<script src="/{{ fingerprint['javascripts/application.js'] }}"></script>
</body>
</html>
<div class="app-pane__nav">
{% include "_navigation.njk" %}
{% include "_mobile-navigation.njk" %}
</div>

{% block appBody %}
{{ contents | safe }}
{% endblock %}
</div>
{% endblock %}

{% block bodyEnd %}
<script src="/{{ fingerprint['javascripts/application.js'] }}"></script>
{% endblock %}
39 changes: 20 additions & 19 deletions views/layouts/layout-example.njk
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ title }}</title>
<link href="/{{ fingerprint['stylesheets/main.css'] }}" rel="stylesheet" media="all" />
{#- Include any additional stylesheets specified in the example frontmatter #}
{% for stylesheet in stylesheets %}
<link href="{{ stylesheet }}" rel="stylesheet" media="all" />
{%- endfor %}
{% extends "template.njk" %}

<!--[if lt IE 9]>
<script src="/javascripts/ie.js"></script>
<![endif]-->
<script src="/javascripts/vendor/modernizr.js"></script>
</head>
{% block pageTitle %}{{ title }}{% endblock %}

{% block head %}
<meta name="robots" content="noindex, nofollow">
<link href="/{{ fingerprint['stylesheets/main.css'] }}" rel="stylesheet" media="all" />
{#- Include any additional stylesheets specified in the example frontmatter #}
{% for stylesheet in stylesheets %}
<link href="{{ stylesheet }}" rel="stylesheet" media="all" />
{%- endfor %}

<!--[if lt IE 9]>
<script src="/javascripts/ie.js"></script>
<![endif]-->
<script src="/javascripts/vendor/modernizr.js"></script>
{% endblock %}

{% block body %}
<body class="app-example-page">
{% block body %}
{% block appBody %}
{{ contents | safe }}
{% endblock %}
<script src="/javascripts/vendor/iframeResizer.contentWindow.js"></script>
<script src="/{{ fingerprint['javascripts/govuk-frontend.js'] }}"></script>
</body>
</html>
{% endblock %}
4 changes: 2 additions & 2 deletions views/layouts/layout-pane.njk
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% extends "_generic.njk" %}

{% block body %}
{% block appBody %}
<div class="app-pane__body">
<div class="app-pane__subnav app-hide-mobile">
{% include "_subnav.njk" %}
</div>
<div class="app-pane__content">
<main id="content" class="app-content" role="main">
<main id="main-content" class="app-content" role="main">
<div class="app-content__header">
<h1 class="govuk-heading-xl">
<span class="govuk-caption-xl">
Expand Down
4 changes: 2 additions & 2 deletions views/layouts/layout-single-page.njk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% extends "_generic.njk" %}

{% block body %}
{% block appBody %}
<div class="app-pane__content">
<main id="content" class="govuk-main-wrapper govuk-main-wrapper--l" role="main">
<main id="main-content" class="govuk-main-wrapper govuk-main-wrapper--l" role="main">
<div class="govuk-width-container app-site-width-container">
{{ contents | safe }}
</div>
Expand Down
5 changes: 2 additions & 3 deletions views/layouts/layout.njk
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{% extends "_generic.njk" %}

{% block body %}
{% block appBody %}
<div class="app-pane__content">
<main id="content" role="main">
<main id="main-content" role="main">
{{ contents | safe }}
</main>

{% include "_footer.njk" %}
</div>

{% endblock %}