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

Increase the likelihood that service teams will only include the bits of the Design System they are using #3731

Closed
10 of 13 tasks
36degrees opened this issue Apr 10, 2024 · 4 comments
Assignees
Labels
epic Epics are used in planning project boards to group related stories

Comments

@36degrees
Copy link
Member

36degrees commented Apr 10, 2024

Brief

Increase the likelihood that service teams will only include the bits of the Design System they are actually using in their service.

Our documentation is currently optimised for getting people started quickly. The simplest thing that a service team can do when getting started is to include all of the CSS and JavaScript from GOV.UK Frontend. Unfortunately, this is where most service teams stop.

This means that (anecdotally, of those we've looked at) most services include the code for all of the components, whether they're using them or not. For example, a simple service that's mostly basic form controls and buttons is likely to be including all of the code for tabs, accordions, character count despite not using them.

For example, we might:

  • make changes to the code so that it's easier to selectively include bits of GOV.UK Frontend
  • improve our documentation to better explain how to do this and what the benefits are
  • explain the impact that this change can have in terms of web performance and sustainability, perhaps through blogging or talking about this at a monthly call

We think that doing this will:

  • improve the overall performance of services across GOV.UK
  • reduce the carbon footprint of services across GOV.UK
  • reduce the impact on performance as we continue to add additional, more complicated components to the Design System

Epic lead

TBC

Driving role(s)

Developers, tech writers

Supporting roles

Content designer?

Needs awareness

If we plan to make some noise about this we may we want to involve the community designer and comms folks.

Further detail

This is an area where I think we can have a real 'multiplier impact' on web performance and sustainability across the GOV.UK estate just by gently nudging people towards optimising what they're including.

Although it'd be interesting to look at, I think we should consider the following out of scope (for now):

  • splitting out individual features of components
  • code splitting and dynamic imports
  • improving caching strategies

Let's assume that most service teams will have a single JS / CSS file for their service that includes GOV.UK Frontend, and focus on getting that right before we optimise for individual pages within the service.

Tasks

  1. javascript performance sass / css
    owenatgov romaricpascal
  2. documentation
    claireashworth
  3. 36degrees owenatgov
    romaricpascal
  4. documentation
    claireashworth
  5. 36degrees
  6. owenatgov romaricpascal
  7. javascript performance
    romaricpascal
  8. small story tooling
@36degrees 36degrees added the epic Epics are used in planning project boards to group related stories label Apr 10, 2024
@36degrees
Copy link
Member Author

36degrees commented Apr 11, 2024

I'll leave defining the tasks we want to do until this epic is picked up, but a few thoughts on things we could do:

  • Optimise the Design System website to only include the CSS and JS for components we're using #3732 – this would help us learn where the pain points are
  • move as many responsibilities from initAll to the components (for example, the data-module selector is only defined in initAll) to make it easier to include the JS for components without initAll
  • make it possible to generate a custom version of the 'dist' JS + CSS, like you could with Bootstrap in ye olde days
  • improve our documentation to nudge people towards optimising what they include
  • create a calculator that asks people to select the components they're actually using, and then show them how much they could shave off their file size – it could also
    • ask for approx number of sessions and calculate the impact on carbon footprint
    • allow the data to be submitted and feed into a dashboard with the estimated collective impact the changes have had
  • blog about it
  • show and tell about it
  • run a clinic or workshop focused around it

@36degrees
Copy link
Member Author

Another suggestion that came up in a recent conversation with @romaricpascal – allowing users to specify which components (or other parts of the code?) they want to include the Sass for using a Sass variable:

$govuk-included-components: (
    "button",
    "header",
    "footer"
);

@import "govuk/all";

@36degrees
Copy link
Member Author

If we're revisiting our guidance on importing things, we might want to take this opportunity to split up or re-organise the 'Import CSS, assets and JavaScript' page which is becoming a bit unwieldy.

@36degrees
Copy link
Member Author

Calling this done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic Epics are used in planning project boards to group related stories
Projects
None yet
Development

No branches or pull requests

4 participants