diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 70c37d942..4f5f7613a 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -2,5 +2,6 @@ //= link application.css //= link legacy_layout.css //= link application.js +//= link es6-components.js //= link legacy_layout.js //= link html5.js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c53ef1099..2647b6d81 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -10,5 +10,4 @@ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD // GO AFTER THE REQUIRES BELOW. // -//= require govuk_publishing_components/dependencies -//= require govuk_publishing_components/all_components +//= require govuk_publishing_components/dependencies \ No newline at end of file diff --git a/app/assets/javascripts/es6-components.js b/app/assets/javascripts/es6-components.js new file mode 100644 index 000000000..755634ff2 --- /dev/null +++ b/app/assets/javascripts/es6-components.js @@ -0,0 +1,15 @@ +// These modules from govuk_publishing_components +// depend on govuk-frontend modules. govuk-frontend +// now targets browsers that support `type="module"`. +// +// To gracefully prevent execution of these scripts +// on browsers that don't support ES6, this script +// should be included in a `type="module"` script tag +// which will ensure they are never loaded. + +//= require govuk_publishing_components/components/button +//= require govuk_publishing_components/components/checkboxes +//= require govuk_publishing_components/components/error-summary +//= require govuk_publishing_components/components/layout-header +//= require govuk_publishing_components/components/radio +//= require govuk_publishing_components/components/skip-link \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index d20114b05..d74498fa2 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,6 +1,7 @@ <% content_for :head do %> <%= stylesheet_link_tag "legacy_layout", :media => "all" %> <%= javascript_include_tag "legacy_layout" %> + <%= javascript_include_tag "es6-components", type: "module" %> <%= csrf_meta_tag %> <%= render "layouts/google_tag_manager" %> <%= yield :extra_headers %>