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

Update documentation to reference new ways of importing components #47

Closed
36degrees opened this issue May 7, 2020 · 0 comments · Fixed by #56
Closed

Update documentation to reference new ways of importing components #47

36degrees opened this issue May 7, 2020 · 0 comments · Fixed by #56
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@36degrees
Copy link
Contributor

What

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:

@import "govuk/base";

@import "govuk/components/button/index"; 
@import "govuk/components/details/index"; 

If using a Sass compiler that supports index files, this could just be:

@import "govuk/base";

@import "govuk/components/button"; 
@import "govuk/components/details"; 

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.

Who needs to know about this

@m-green, @36degrees, @hannalaakso

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Development

Successfully merging a pull request may close this issue.

2 participants