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

EES-5539 Fix excessively large CodeBlock dependency bundle #5295

Merged
merged 4 commits into from
Oct 1, 2024
Merged

Conversation

ntsim
Copy link
Collaborator

@ntsim ntsim commented Sep 30, 2024

This PR fixes the CodeBlock component importing the entirety of Highlight.js and creating excessively large bundles.

We've now stripped this down to the bare minimum and only import in the languages that we need (i.e. R and Python).

As part of this, we've also swapped out the current colour theme for the same one that's used by the GOV.UK Design System (which appears to be based on GitHub's). We've also made some improvements to make most of the colours WCAG AAA colour contrast compliant.

The colours now look like:

image

image

Related changes

  • Minor tweaks to CodeBlock props to improve type-safety and replaced code prop with children to be more idiomatic.
  • Added build:analyze script that can be ran from the frontend project to analyze its bundles using @next/bundle-analyzer.

ntsim added 4 commits October 1, 2024 10:14
This change swaps in the GOV.UK Design System's code highlighting
colour theme (which appears to be based on GitHub's). We've made a few
tweaks to improve the colour contrast further to WCAG AAA standard.
Copy link
Collaborator

@bennettstuart bennettstuart 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, just check with Nusrath before merging (today)

@ntsim ntsim merged commit 1f4f27e into dev Oct 1, 2024
7 checks passed
@ntsim ntsim deleted the ees-5539 branch October 1, 2024 09:44
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.

2 participants