Skip to content

Commit c3c3dff

Browse files
committed
Update components documentation with new files
1 parent 4261b56 commit c3c3dff

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

docs/contributing/coding-standards/components.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Generally, folder and file names should be singular, for example ‘accordion’
1111
When creating your component, you should create the following files in the component’s folder:
1212

1313
- `README.md` - Summary documentation with links to the installation instructions and component documentation on <https://design-system.service.gov.uk/>
14-
- `_[component-name].scss` - An SCSS file to generate the styles for this component only. It delegates the CSS generation to the \_index.scss file.
15-
- `_index.scss` - The actual styles for the component that you can import in 2 ways - [on their own using `[component-name].scss`](https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#import-specific-parts-of-the-css) or [alongside other components in `components/_index.scss`](https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#import-specific-parts-of-the-css)
14+
- `_index.scss` - The main Sass entry point for the component. Generates the styles by including the mixin from the `_mixin.scss` file. You can include it [on its own](https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#import-specific-parts-of-the-css), or [alongside other components in `components/_index.scss`](https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#import-specific-parts-of-the-css)
15+
- `_mixin.scss` - The actual styles for the component, contained within a mixin. The mixin is included by the `_index.scss` file. This file should not be included directly.
1616
- `[component-name].yaml` - Lists the component's Nunjucks macro options and includes examples using these options. Both the options and examples are used to generate component documentation in the review app. The examples are also used to test component behaviour, and to generate [fixtures for testing alternative implementations of the design system](https://frontend.design-system.service.gov.uk/testing-your-html/).
1717
- `macro.njk` - The main entry point for rendering the component. It provides a `govuk[ComponentName](params)` macro, delegating render to the `template.njk` file
1818
- `template.njk` - The template used for rendering the component using any `params` provided to the macro
@@ -24,6 +24,11 @@ If your component uses JavaScript, you must also create the following files in t
2424
- `[component-name].unit.test.mjs` - Unit tests to verify any component-specific lower-level logic.
2525
- `[component-name].test.js` - Functional tests to verify the behaviour of the whole component
2626

27+
In version 7 of GOV.UK Frontend, we will remove support for `@import` in Sass. Before then, you must include the following files to continue supporting `@import`:
28+
29+
- `_[component-name].import.scss` - An import-only SCSS file to generate the styles for just this component. It delegates the CSS generation to the \_index.import.scss file, and emits a warning that this usage is deprecated.
30+
- `_index.import.scss` - An import-only SCSS file which generates the styles by including the mixin from the `_mixin.scss` file.
31+
2732
## Building your components
2833

2934
To help you build and initialise your own JavaScript components, GOV.UK Frontend provides some of its internal features for you to reuse. Follow our guidance on [building JavaScript components](https://frontend.design-system.service.gov.uk/building-your-own-javascript-components/#building-your-own-javascript-components) to use these features.

0 commit comments

Comments
 (0)