You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can still import a single component without having to separately import its dependencies:
@import"govuk/components/button/button";
However, this is only really meant to be used when you need to import a single component in isolation, e.g. if you're creating a React component.
Why
Importing the components using the index file avoids re-importing the 'base' (settings, tools and helpers layers) multiple times, improving compilation times.
What
Update the guidance on importing CSS, assets and JavaScript to reflect the changes in Allow components to be imported with or without dependencies govuk-frontend#1797.
Check if there are other parts of the documentation that also need to be updated.
Further detail
With the changes in alphagov/govuk-frontend#1797, the preferred way to import a subset of the components will be to do something like:
If using a Sass compiler that supports index files, this could just be:
You can still import a single component without having to separately import its dependencies:
However, this is only really meant to be used when you need to import a single component in isolation, e.g. if you're creating a React component.
Why
Importing the components using the index file avoids re-importing the 'base' (settings, tools and helpers layers) multiple times, improving compilation times.
Who needs to know about this
@m-green, @36degrees, @hannalaakso
The text was updated successfully, but these errors were encountered: