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

Configure AssetHelper to load individual stylesheets #3200

Merged

Conversation

jon-kirwan
Copy link
Contributor

@jon-kirwan jon-kirwan commented Mar 14, 2023

What

https://trello.com/c/9RMdBVHj/1866-enable-individual-loading-of-stylesheets-in-collections

Changes to load component and view style sheets only required on the page being viewed. For example, CSS for "topics" only loads on the following pages:

Why

This reduces the amount of CSS required for each page and increases the ability of a browser to cache the stylesheets - this should mean a faster load time for both first time and repeat visitors.

See RFC #149 for more details.

Review URL(s)

Visual changes

None

Anything else

  • application.scss imports custom margin helpers /helpers/_margins.scss which I think could be replaced with Design System utility classes (with some very minor differences).
  • application.scss then only includes the following settings (below) which can be removed since they are included with _individual_component_support.scss (imported from govuk_publishing_components) and application.scss can then be removed
$govuk-new-link-styles: true;
$govuk-include-default-font-face: false;

@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 14, 2023 10:50 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 38b1599 to 019cab3 Compare March 14, 2023 12:32
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 14, 2023 12:33 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 019cab3 to 54235da Compare March 14, 2023 13:08
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 14, 2023 13:08 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 54235da to 96ba9e2 Compare March 14, 2023 15:57
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 14, 2023 15:57 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 96ba9e2 to 48d7e89 Compare March 14, 2023 16:17
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 14, 2023 16:17 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 48d7e89 to 0f20fce Compare March 14, 2023 17:32
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 14, 2023 17:32 Inactive
@jon-kirwan jon-kirwan requested a review from MartinJJones March 15, 2023 11:06
@jon-kirwan jon-kirwan requested a review from KludgeKML March 15, 2023 11:06
@jon-kirwan jon-kirwan requested a review from maxgds March 15, 2023 11:06
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 0f20fce to 955e8f5 Compare March 15, 2023 11:09
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 15, 2023 11:09 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 955e8f5 to bf84ac2 Compare March 15, 2023 12:20
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 15, 2023 12:21 Inactive
@jon-kirwan jon-kirwan marked this pull request as ready for review March 15, 2023 12:23
@jon-kirwan jon-kirwan changed the title Configure asset helper to load individual stylesheets Configure AssetHelper to load individual stylesheets Mar 15, 2023
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from bf84ac2 to 9001d5f Compare March 15, 2023 13:40
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 15, 2023 13:40 Inactive
Copy link
Contributor

@KludgeKML KludgeKML left a comment

Choose a reason for hiding this comment

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

Looks good to me.

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! The changes look good to me, any thoughts I had are already covered in the "Anything else" section you provided in the PR description 👍

@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 20, 2023 11:24 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 06d7a81 to f74db2a Compare March 20, 2023 14:30
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 20, 2023 14:31 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch 2 times, most recently from 45c9bb1 to 4979ff4 Compare March 20, 2023 14:57
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 20, 2023 14:58 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 4979ff4 to 43b7fcb Compare March 20, 2023 15:04
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 20, 2023 15:04 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 43b7fcb to fc05b3c Compare March 20, 2023 15:28
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 20, 2023 15:28 Inactive
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from fc05b3c to 4cd6ed5 Compare March 21, 2023 09:59
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 21, 2023 09:59 Inactive
- Hoist body content in application layout
- Call AssetHelper helper `render_component_stylesheets`
- Remove GOV.UK Component stylesheets from application stylesheet
Remove unused _margins.scss and replace with responsive spacing override class
@jon-kirwan jon-kirwan force-pushed the configure-asset-helper-to-load-individual-stylesheets branch from 4cd6ed5 to a60c19b Compare March 21, 2023 10:19
@govuk-ci govuk-ci temporarily deployed to collections-pr-3200 March 21, 2023 10:20 Inactive
@jon-kirwan jon-kirwan merged commit ea00408 into main Mar 21, 2023
@jon-kirwan jon-kirwan deleted the configure-asset-helper-to-load-individual-stylesheets branch March 21, 2023 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants