-
Notifications
You must be signed in to change notification settings - Fork 17
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
Use govuk-frontend v5 #3436
Closed
Closed
Use govuk-frontend v5 #3436
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
patrickpatrickpatrick
force-pushed
the
use-govuk-frontend-v5
branch
from
November 13, 2023 11:20
a26bbca
to
06e8623
Compare
This is blocked by alphagov/govuk_publishing_components#3700 |
patrickpatrickpatrick
force-pushed
the
use-govuk-frontend-v5
branch
from
November 16, 2023 15:44
7b0aa19
to
390a6ea
Compare
patrickpatrickpatrick
force-pushed
the
use-govuk-frontend-v5
branch
from
November 28, 2023 10:51
5c9a41a
to
76540b5
Compare
MartinJJones
force-pushed
the
use-govuk-frontend-v5
branch
from
March 14, 2024 12:53
046b8de
to
d815e45
Compare
MartinJJones
force-pushed
the
use-govuk-frontend-v5
branch
from
April 3, 2024 10:22
d815e45
to
8d764ab
Compare
To prevent browsers evaluating JS that isn't supported, components that contain code from govuk-frontend have been moved to a separate file `es6-components.js` which is included in `application.html.erb` as a script tag with `type="module"`.
govuk_publishing_components has govuk-frontend as a dependency. govuk-frontend v5 now targets browsers that support ES6. This means that the UMD modules used in govuk_publsihing_components from govuk-frontend use features of ES6 and so it means that Uglifier can't be used anymore because it only supports ES5. As well as installing terser and updating the config, this commit also contains a patch for getting terser working. Sprockets doesn't have an built-in loader for terser so we need to add this functionality.
MartinJJones
force-pushed
the
use-govuk-frontend-v5
branch
3 times, most recently
from
April 3, 2024 10:43
c7a6ca1
to
32ab69d
Compare
In govuk-frontend v5, the `init` function is now called when a module is created. This meant changing how the `initAll()` function works in govuk_publishing_components so that it does not call `init()` when initialising components JavaScript. It also meant moving `init` functions in components to the constructor to bring them in line with the new way of initialising.
- Remove $legacy attribute in govuk-colour
MartinJJones
force-pushed
the
use-govuk-frontend-v5
branch
from
April 3, 2024 10:47
32ab69d
to
0ecd1bf
Compare
Closing as we have a new branch to upgrade to v5.1.0 - #3648 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trello
What
es6-components.js
fileWhy
govuk_publishing_components uses v5 of govuk-frontend. There are several breaking changes in this release and so we need to update the applications that use govuk_publishing_components. Please read what has changed in govuk_publishing_components and govuk-frontend. This specific changes this PR addresses are:
es6-components.js
filegovuk-frontend
loads a page with JS on it, attempting to parse the JS fromgovuk-frontend
will cause an error. To avoid this from happening, JS that containsgovuk-frontend
JS has been moved to seperate file which will be loaded in a script tag withtype="module"
. This will prevent the JS from being parsed and so prevent the errorFollow these steps if you are doing a Rails upgrade.