Skip to content

Update govuk-design-system scss to fix sass deprecation warnings - #110

Open
rachelhsmith wants to merge 5 commits into
torchbox:mainfrom
rachelhsmith:chore/update-legacy-sass
Open

Update govuk-design-system scss to fix sass deprecation warnings#110
rachelhsmith wants to merge 5 commits into
torchbox:mainfrom
rachelhsmith:chore/update-legacy-sass

Conversation

@rachelhsmith

@rachelhsmith rachelhsmith commented May 28, 2026

Copy link
Copy Markdown
Contributor

This PR addresses 3 types of deprecation warnings for things that will be removed in Dart Sass 3.0.0

https://sass-lang.com/documentation/breaking-changes/if-function/
https://sass-lang.com/documentation/breaking-changes/import/
https://sass-lang.com/documentation/breaking-changes/legacy-js-api/

These warnings are currently causing lots of noise for projects with tbxforms installed at build time and runtime.

Screenshot 2026-05-28 at 13 18 35

The contribution advice has been followed https://github.com/torchbox/tbxforms/blob/main/CONTRIBUTING.md#updating-govuk-frontend

Breaking changes will be introduced by this upgrade:

  1. @import is no longer supported

tbxforms now uses the Sass module system. The @import rule is not compatible with files that use @use
internally.

Before:
@import 'path/to/tbxforms';

After:
@use 'path/to/tbxforms';


  1. Variable overrides must use with (...)

In the @import system, variables could be set before the import. This no longer works. All configuration must
be passed via with (...) on the @use rule.

Before:
$tbxforms-font-family: 'My Font', sans-serif;
@import 'path/to/tbxforms';

After:
@use 'path/to/tbxforms' with (
$tbxforms-font-family: 'My Font', sans-serif,
);


  1. Individual colour variables are no longer configurable

The following variables are now derived values and cannot be set directly. They still exist for read access in
your own styles but will throw an error if passed via with (...).

Screenshot 2026-05-28 at 13 36 17

To override colours, use $tbxforms-functional-colours and pass only the keys you want to change. Values must
be a Sass colour (e.g. #1d70b8) or a palette reference map (e.g. (name: 'blue', variant: 'shade-10')).

  Before:
  $tbxforms-text-colour: #333;
  $tbxforms-error-colour: #d4351c;
  @import 'path/to/tbxforms';

  After:
  @use 'path/to/tbxforms' with (
      $tbxforms-functional-colours: (
          text: #333,
          error: #d4351c,
      ),
  );

@rachelhsmith
rachelhsmith requested a review from kylebayler as a code owner May 28, 2026 12:13

@kylebayler kylebayler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hey @rachelhsmith , thanks for this!

I've had a quick look and noticed a couple of things:

  1. There are lots of unused govuk-frontend styles now included, things like button groups, grid, main, template, and lots more. Do these get included in the bundled tbxforms package? If not, and they're just there because copying/pasting everything from govuk-frontend is easier, then that's OK, but if they end up in the final package, they should be removed. We only want to include the styles required for tbxforms, not to run the entire govuk-frontend.
  2. This looks like quite a big restructure from GDS! Have any classnames changed? I'm amazed that no changes were needed to any templates.
  3. Are any changes needed to Wagtail Kit to support these changes? Perhaps around colours?

@rachelhsmith
rachelhsmith force-pushed the chore/update-legacy-sass branch from d31ef4b to 2fba8d6 Compare June 1, 2026 10:12
@rachelhsmith

Copy link
Copy Markdown
Contributor Author

Hi @kbayliss, thanks for having a look. In answer to your questions....

  1. I've removed / commented out imports for govuk-frontend styles that aren't used by tbxforms. I had missed a few originally but I believe that with this commit there are no longer unnecessary styles in there: 8436bd5
  2. The class names themselves haven't changed
  3. Wagtail kit will need the colour variables changed to the new format (from the table in point 3 of the breaking changes list). It is already using @use instead of @import so it is not affected by the other breaking changes

@kylebayler

Copy link
Copy Markdown
Collaborator

@rachelhsmith fab, thanks! Can you please open an issue, or ideally an MR, on Kit so the required changes are documented?

If you open an MR, then I'll review it and will test the changes introduced here in a project scenario (at the moment, I'm just reviewing code and relying on your testing).

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