Closed 36degrees closed 5 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:
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
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";
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.
Calling this done.
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.