Skip to content

Conversation

@andysellick
Copy link
Contributor

@andysellick andysellick commented Oct 20, 2025

What

Fix the rendering of the component guide in applications that don't use the individual component css loading, by switching the component guide to import all of the CSS for all of the components by default and turn off the rendering for individual component css in the guide.

component_guide_stylesheet is a new method to pass into the application dartsass config to provide the component guide stylesheet. This is used in the existing all_stylesheets method and this means that this change will not break component guides for applications regardless of whether they use individual css loading or not.

Having said that, if an application is still using individual css loading and has its own components, those components will not render properly in the component guide (because their CSS won't load). The fix for this is either to add the application component stylesheets in somehow or switch to not using individual css loading (which we are currently moving towards for all applications).

Thanks to @MartinJJones for pairing on this.

Why

We've disabled the individual component css loading in a couple of applications, which has broken the component guide for those applications.

Relates to #5074

Visual Changes

None.

https://gov-uk.atlassian.net/jira/software/c/projects/PNP/boards/1356?selectedIssue=PNP-9612

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-5087 October 20, 2025 13:46 Inactive
@andysellick
Copy link
Contributor Author

@AshGDS this is still a work in progress, but wanted to give you a heads up as it somewhat nullifies the work you did recently on loading other component's CSS on the preview pages - with this change we'll be loading all of the CSS on every page.

@AshGDS
Copy link
Contributor

AshGDS commented Oct 20, 2025

Thanks @andysellick - is it possible to preserve the individual CSS functionality under a configuration flag?

MartinJJones and others added 2 commits October 27, 2025 08:24
- include detail of how to get the component guide stylesheet included in an application not using individual css loading
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-5087 October 27, 2025 08:25 Inactive
- these two tests specifically check individual css loading within the component guide, which has now been disabled
- other tests in this file use custom pages outside of the guide, where individual css loading still works
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-5087 October 27, 2025 08:54 Inactive
- this was very weird, have documented this change in #5099 as we may need to revert it and fix it properly
Copy link
Contributor

@MartinJJones MartinJJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Andy, the changes look good to me.

Thanks for also creating the related issue for the option select component test, I'll have a further look at this as well, it does look like the test itself could be a bit flawed as you mention in the issue description.

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-5087 October 29, 2025 10:41 Inactive
@andysellick andysellick merged commit ec4c45e into main Oct 29, 2025
11 checks passed
@andysellick andysellick deleted the fix-component-guide branch October 29, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants