alphagov / govuk-design-system

One place for service teams to find styles, components and patterns for designing government services.
https://www.gov.uk/design-system
MIT License
512 stars 232 forks source link

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

Closed 36degrees closed 5 months ago

36degrees commented 7 months ago

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:

We think that doing this will:

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):

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
- [ ] https://github.com/alphagov/govuk-design-system/issues/3732
- [ ] https://github.com/alphagov/govuk-frontend-docs/issues/435
- [ ] https://github.com/alphagov/govuk-frontend/issues/4945
- [ ] https://github.com/alphagov/govuk-frontend-docs/issues/436
- [ ] https://github.com/alphagov/govuk-frontend/issues/4946
- [ ] Explore how get started links to other sections
- [ ] https://github.com/alphagov/govuk-design-system/issues/3745
- [ ] 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
- [ ] Share this work to a wider audience e.g. by blogging about it or running a Show & Tell
- [ ] https://github.com/alphagov/govuk-frontend/issues/4960
- [ ] https://github.com/alphagov/govuk-frontend/issues/4957
- [ ] https://github.com/alphagov/govuk-frontend/issues/4964
- [ ] https://github.com/alphagov/govuk-frontend/issues/4978
36degrees commented 7 months ago

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:

36degrees commented 7 months ago

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 commented 7 months ago

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 commented 5 months ago

Calling this done.