diff --git a/source/importing-css-assets-and-javascript/index.html.md.erb b/source/importing-css-assets-and-javascript/index.html.md.erb index 3ee96595..6b60ae82 100644 --- a/source/importing-css-assets-and-javascript/index.html.md.erb +++ b/source/importing-css-assets-and-javascript/index.html.md.erb @@ -137,6 +137,12 @@ You can also use your own function to generate paths, for example if you're usin ## JavaScript +Before you import JavaScript from GOV.UK Frontend, you'll need to add the following to the top of the `
` section of your page template (if you're not [using our Nunjucks macros](/use-nunjucks/)): + +```html + +``` + To import the JavaScript from GOV.UK Frontend, you can either: - add GOV.UK Frontend's JavaScript file to your HTML @@ -220,6 +226,10 @@ const { initAll } = require('govuk-frontend') initAll() ``` +### UMD and `window` globals support + +We encourage the use of ES modules. For projects that cannot use them and require UMD or `window` globals, our package contains `.bundle.js` files. + ### Select and initialise part of a page If you update a page with new markup, for example a modal dialogue box, you can run `initAll` with a `scope` parameter to initialise the components on part of a page.