Skip to content
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

[DO NOT MERGE YET] Remove slimmer/static dependency #1890

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

KludgeKML
Copy link
Contributor

@KludgeKML KludgeKML commented Nov 12, 2024

Removes the need to call out to static via slimmer for layouts.

  • Remove slimmer
  • Layouts now directly call the layout_for_public component
  • Emergency/Global banner support provided by the govuk_web_banners gem

https://trello.com/c/O6JhukLu/245-remove-slimmer-email-alert-frontend

Practical differences in rendered pages:

  • stylesheets are now more granular (the static application stylesheet is no longer downloaded, only the individual component sheets). This has both pros and cons (pros: more granular/lightweight for email-alert-frontend pages, cons: less efficient for overall gov.uk browsing. Cons will be rectified as we move towards shared component stylesheet folders).
  • pages now no longer have the meta http-equiv="Content-Type" element, as that is now obsolete (<meta charset="utf-8">) covers it.
  • slimmer used to hoist a lot of meta tags to the top of the head. They now appear in the order specified in the layout.

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

@KludgeKML KludgeKML force-pushed the no-slimmer branch 5 times, most recently from e2186cf to 5a0885d Compare November 14, 2024 16:31
@KludgeKML KludgeKML force-pushed the no-slimmer branch 5 times, most recently from 662a4e2 to e3095fa Compare February 10, 2025 15:40
@KludgeKML KludgeKML marked this pull request as ready for review February 10, 2025 15:40
@KludgeKML KludgeKML changed the title No slimmer Remove slimmer/static dependency Feb 10, 2025
@KludgeKML KludgeKML changed the title Remove slimmer/static dependency [DO NOT MERGE YET] Remove slimmer/static dependency Feb 10, 2025
@KludgeKML KludgeKML force-pushed the no-slimmer branch 2 times, most recently from 39e5915 to 29591e6 Compare February 13, 2025 12:33
@KludgeKML KludgeKML force-pushed the no-slimmer branch 3 times, most recently from f148e23 to 91cf9d9 Compare February 19, 2025 10:30
- TODO about choosing account layout will be addressed
  in a later commit, for the moment just remove all slimmer
  calls. We intend to replace this with a custom layout file
  for accounts.
- Update layout to use layout_for_public component directly
- Update JS to include JS support for layout components
- Update SCSS file to build component support CSS
  We won't get this from static any more
- Add exclude_css_from_static = false to configuration
- Layout does not include account-specific code, and has
  a section explicitly adding gem_component CSS for the components
  added by layout_for_public (since these can't be included
  automatically). Once added, we call render_component_stylesheets
  as part of the content_for :head, which is yielded to in
  the layout.
- Layout removes the metadata_description section, this will be
  handled in the following commit.
- rendering-application (added by slimmer) meta-tag recreated here.
- This was previously handled as a content_for :meta_description
  in the layout, but it was only used by this template. Since we
  now have a content_for :head in the layout, use it here to
  append to that block before it's sent to the layout_for_public
  component.
- Add a test for this, since it wasn't being checked for and it
  is useful to confirm this refactor.

Audit Trail:
https://github.com/alphagov/email-alert-frontend/blob/bc3ffdcd72f09708635558350493d5ef9549a018/app/views/layouts/application.html.erb#L34-L36
https://github.com/alphagov/email-alert-frontend/blob/bc3ffdcd72f09708635558350493d5ef9549a018/app/views/subscription_authentication/expired.html.erb#L2
- Add JS used by global banners, and banner dependencies
- Add global/emergency banner support in layouts
- Add initializer for emergency banner REDIS support
- Mock redis client in all tests (we're not explicitly
  testing emergency banner support here, since we assume
  that's tested adequately in the gem).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant