-
Notifications
You must be signed in to change notification settings - Fork 320
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
Update review app to use new JavaScript loading strategy #3508
Comments
These PRs are in review to close this issue off: |
Do we want to continue using window globals for modules? <script type="module" src="/javascripts/all.min.js"></script>
<script type="module">window.GOVUKFrontend.initAll()</script> Aware that we shimmed the
Or can we decide to use modules as intended? <script type="module">
import { initAll } from '/javascripts/all.min.js'
initAll()
</script> We'd need to keep |
Caught up with @romaricpascal yesterday and we're happy that window globals are no longer necessary in ES modules so we've switched to We'll continue to support UMD bundles (with window globals) in v5 but will deprecate them in future |
We'll want to update the review app further for testing purposes, as the review app and its tests are in a bit of a wonky state. The app neither follows:
So we're not quite testing that GOV.UK Frontend does what it's meant to in our tests, more that our review app bundle does what GOV.UK Frontend is meant to do. I think 1. will be the option as our tests check what's available in the exports but we may want to test different things (eg. |
@romaricpascal Yeah that's my plan, just need to replace We'd go back to it being unminified so probably good to add Update: I've tried it out as part of #3726 |
We'd need to use a bundled version to avoid a big network waterfall (as child modules are discovered and downloaded) |
Is there anything left to do on this? |
@36degrees Looks like we're all done 🎉 There's a tiny bit of |
What
Update the snippet setting a class on the on the document's
body
to mark where GOV.UK Frontend is supported with agovuk-frontend-supported
class, in complement of thejs-enabled
one marking where JavaScript is available.That class will be set on the detection of
noModule
inHTMLScriptElement.prototype
as it's the best way we've found to identify the browsers we support.Why
We currently set a
js-enabled
class on the body to signpost that JavaScript is available in the browser and hook the styles of our components to it. It lets us style our components as early as possible with the assumption that they’ll be enhanced by JavaScript. This avoids a flicker of components showing their “no JavaScript styles” before JavaScript loads.We’ll keep that to avoid breaking styles of services that may still want to run their own components on good old
<script>
tags like they do now.We’ll complement that class with a new
govuk-frontend-supported
one that highlights that GOVUK Frontend can be initialised.Who needs to work on this
Developers
Who needs to review this
Developers
Done when
Tasks
The text was updated successfully, but these errors were encountered: