File tree Expand file tree Collapse file tree 12 files changed +29
-30
lines changed Expand file tree Collapse file tree 12 files changed +29
-30
lines changed Original file line number Diff line number Diff line change @@ -175,14 +175,9 @@ module.exports = metalsmith
175
175
done ( )
176
176
} )
177
177
178
- // build the entrypoint for application specific JavaScript
178
+ // build the entrypoints for application specific JavaScript
179
179
. use ( rollup ( 'javascripts/application.mjs' ) )
180
-
181
- // build GOV.UK Frontend JavaScript
182
- . use ( rollup ( 'javascripts/govuk-frontend.mjs' ) )
183
-
184
- // build the entrypoint for example specific JavaScript
185
- . use ( rollup ( 'javascripts/example.mjs' ) )
180
+ . use ( rollup ( 'javascripts/application-example.mjs' ) )
186
181
187
182
// add hash to files in production
188
183
. use ( ( files , metalsmith , done ) => {
Original file line number Diff line number Diff line change
1
+ import { initAll } from 'govuk-frontend'
2
+
3
+ import ExamplePage from './components/example-page.mjs'
4
+
5
+ // Initialise GOV.UK Frontend
6
+ initAll ( {
7
+ // Auto focusing the error summary and notification banner is not useful
8
+ // when used in examples, and causes the viewport to scroll
9
+ errorSummary : { disableAutoFocus : true } ,
10
+ notificationBanner : { disableAutoFocus : true }
11
+ } )
12
+
13
+ new ExamplePage ( document ) . init ( )
Original file line number Diff line number Diff line change
1
+ import { initAll } from 'govuk-frontend'
2
+
1
3
import Analytics from './components/analytics.mjs'
2
4
import BackToTop from './components/back-to-top.mjs'
3
5
import CookieBanner from './components/cookie-banner.mjs'
@@ -11,6 +13,9 @@ import OptionsTable from './components/options-table.mjs'
11
13
import Search from './components/search.mjs'
12
14
import AppTabs from './components/tabs.mjs'
13
15
16
+ // Initialise GOV.UK Frontend
17
+ initAll ( )
18
+
14
19
// Initialise cookie banner
15
20
var $cookieBanner = document . querySelector ( '[data-module="govuk-cookie-banner"]' )
16
21
new CookieBanner ( $cookieBanner ) . init ( )
Original file line number Diff line number Diff line change 1
1
function ExamplePage ( $module ) {
2
2
this . $module = $module
3
3
}
4
+
4
5
ExamplePage . prototype . init = function ( ) {
5
6
var $module = this . $module
6
7
if ( ! $module ) {
@@ -9,6 +10,7 @@ ExamplePage.prototype.init = function () {
9
10
var $form = $module . querySelector ( 'form[action="/form-handler"]' )
10
11
this . preventFormSubmission ( $form )
11
12
}
13
+
12
14
ExamplePage . prototype . preventFormSubmission = function ( $form ) {
13
15
// we should only have one form per example
14
16
if ( ! $form ) {
@@ -19,4 +21,4 @@ ExamplePage.prototype.preventFormSubmission = function ($form) {
19
21
} )
20
22
}
21
23
22
- new ExamplePage ( document ) . init ( )
24
+ export default ExamplePage
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ stylesheets:
81
81
<span class =" app-annotate-block__label" >block: bodyEnd</span >
82
82
{{ super () }}
83
83
{# Since we’re not extending the Design System layout we need to add this manually #}
84
- <script type =" module" src =" {{ getFingerprint('javascripts/govuk-frontend .js') }}" ></script >
84
+ <script type =" module" src =" {{ getFingerprint('javascripts/application-example .js') }}" ></script >
85
85
<script type =" module" src =" {{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}" ></script >
86
86
</div >
87
87
{%- endblock %}
Original file line number Diff line number Diff line change @@ -149,6 +149,6 @@ ignoreInSitemap: true
149
149
{% endblock %}
150
150
151
151
{% block bodyEnd %}
152
- <script type =" module" src =" {{ getFingerprint('javascripts/govuk-frontend .js') }}" ></script >
152
+ <script type =" module" src =" {{ getFingerprint('javascripts/application-example .js') }}" ></script >
153
153
<script type =" module" src =" {{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}" ></script >
154
154
{% endblock %}
Original file line number Diff line number Diff line change @@ -14,6 +14,6 @@ layout: false
14
14
{% endblock %}
15
15
16
16
{% block bodyEnd %}
17
- <script type =" module" src =" {{ getFingerprint('javascripts/govuk-frontend .js') }}" ></script >
17
+ <script type =" module" src =" {{ getFingerprint('javascripts/application-example .js') }}" ></script >
18
18
<script type =" module" src =" {{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}" ></script >
19
19
{% endblock %}
Original file line number Diff line number Diff line change 37
37
{% block footer %}{% endblock %}
38
38
39
39
{% block bodyEnd %}
40
- <script type =" module" src =" {{ getFingerprint('javascripts/govuk-frontend.js') }}" ></script >
41
40
<script type =" module" src =" {{ getFingerprint('javascripts/application.js') }}" ></script >
42
41
{% endblock %}
Original file line number Diff line number Diff line change 22
22
{{ contents | safe }}
23
23
{% endblock %}
24
24
{% block bodyEnd %}
25
- <script type =" module" src =" {{ getFingerprint('javascripts/govuk-frontend.js') }}" ></script >
26
- <script type =" module" src =" {{ getFingerprint('javascripts/example.js') }}" ></script >
25
+ <script type =" module" src =" {{ getFingerprint('javascripts/application-example.js') }}" ></script >
27
26
<script type =" module" src =" {{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}" ></script >
28
27
{% endblock %}
Original file line number Diff line number Diff line change 24
24
{{ contents | safe }}
25
25
{% endblock %}
26
26
{% block bodyEnd %}
27
- <script type =" module" src =" {{ getFingerprint('javascripts/govuk-frontend.js') }}" ></script >
28
- <script type =" module" src =" {{ getFingerprint('javascripts/example.js') }}" ></script >
27
+ <script type =" module" src =" {{ getFingerprint('javascripts/application-example.js') }}" ></script >
29
28
<script type =" module" src =" {{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}" ></script >
30
29
{% endblock %}
Original file line number Diff line number Diff line change 35
35
{% endblock %}
36
36
37
37
{% block bodyEnd %}
38
- <script type =" module" src =" {{ getFingerprint('javascripts/govuk-frontend.js') }}" ></script >
39
- <script type =" module" src =" {{ getFingerprint('javascripts/example.js') }}" ></script >
38
+ <script type =" module" src =" {{ getFingerprint('javascripts/application-example.js') }}" ></script >
40
39
<script type =" module" src =" {{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}" ></script >
41
40
{% endblock %}
42
41
You can’t perform that action at this time.
0 commit comments