From eec78d4c4a5a5d66617f1e9ec34b9995bb8d6c4b Mon Sep 17 00:00:00 2001 From: owenatgov Date: Tue, 27 Sep 2022 17:48:45 +0100 Subject: [PATCH] Deprecate compatibility mode settings This includes adding a private setting: `$_govuk-is-legacy-review-app` which is set to `true` in the legacy app stylesheets within the govuk-frontend local review app. We create this temporary dependancy so that warnings aren't fired locally but are fired for users where compatibility mode settings are true in their own sass. --- CHANGELOG.md | 12 +++++++++++- app/assets/scss/app-legacy-ie8.scss | 5 +++++ app/assets/scss/app-legacy.scss | 5 +++++ src/govuk/settings/_compatibility.scss | 26 ++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6afd01346..fc01b8313c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,16 @@ This was added in [pull request #2677: Amend error summary markup to fix page lo ### Deprecated features +#### Stop using the compatibility mode settings + +In GOV.UK Frontend v5.0 we will stop supporting compatibility with legacy codebases. We are therefore deprecating the compatibility mode variables associated with legacy codebases: + +- `$govuk-compatibility-govukfrontendtoolkit` +- `$govuk-compatibility-govuktemplate` +- `$govuk-compatibility-govukelements` + +This was introduced in [pull request #2882: Deprecate compatibility mode settings](https://github.com/alphagov/govuk-frontend/pull/2882). + #### Stop using settings associated with legacy codebases In GOV.UK Frontend v5.0 we will stop supporting compatibility with legacy codebases. As part of this, we are deprecating settings controlled by compatibility mode variables. This includes the `govuk-compatibility` mixin and the following settings: @@ -95,7 +105,7 @@ In GOV.UK Frontend v5.0 we will stop supporting compatibility with legacy codeba - `$govuk-typography-use-rem` - `$govuk-font-family-tabular` -This was introduced in [pull request #2844: Deprecate compatibility mode settings](https://github.com/alphagov/govuk-frontend/pull/2844). +This was introduced in [pull request #2844: Remove compatibility mode from govuk-frontend](https://github.com/alphagov/govuk-frontend/pull/2844). ### Fixes diff --git a/app/assets/scss/app-legacy-ie8.scss b/app/assets/scss/app-legacy-ie8.scss index b240e2a64e..c492b88785 100644 --- a/app/assets/scss/app-legacy-ie8.scss +++ b/app/assets/scss/app-legacy-ie8.scss @@ -8,6 +8,11 @@ $govuk-compatibility-govukfrontendtoolkit: true; $govuk-compatibility-govuktemplate: true; $govuk-compatibility-govukelements: true; +// Suppress compatibility mode deprecation warnings locally +$govuk-suppressed-warnings: ( + "compatibility-mode" +); + // Set Elements assets path $path: "/vendor/govuk_frontend_toolkit/assets/"; diff --git a/app/assets/scss/app-legacy.scss b/app/assets/scss/app-legacy.scss index f50906432c..1fb320638d 100644 --- a/app/assets/scss/app-legacy.scss +++ b/app/assets/scss/app-legacy.scss @@ -8,6 +8,11 @@ $govuk-compatibility-govukfrontendtoolkit: true; $govuk-compatibility-govuktemplate: true; $govuk-compatibility-govukelements: true; +// Suppress compatibility mode deprecation warnings locally +$govuk-suppressed-warnings: ( + "compatibility-mode" +); + // Set Elements assets path $path: "/vendor/govuk_frontend_toolkit/assets/"; diff --git a/src/govuk/settings/_compatibility.scss b/src/govuk/settings/_compatibility.scss index 5c6dcdff46..09252fe787 100644 --- a/src/govuk/settings/_compatibility.scss +++ b/src/govuk/settings/_compatibility.scss @@ -23,9 +23,17 @@ /// /// @type Boolean /// @access public +/// @deprecated Will be removed in v5.0 with the rest of the compatibility mode +/// suite of tools and settings $govuk-compatibility-govukfrontendtoolkit: false !default; +@if $govuk-compatibility-govukfrontendtoolkit == true { + @include _warning("compatibility-mode", "$govuk-compatibility-govukfrontendtoolkit " + + "is deprecated. From version 5.0, GOV.UK Frontend will remove compatibility " + + "with the legacy library govuk_frontend_toolkit."); +} + /// Compatibility Mode: alphagov/govuk_template /// /// Enabling this will: @@ -41,9 +49,17 @@ $govuk-compatibility-govukfrontendtoolkit: false !default; /// /// @type Boolean /// @access public +/// @deprecated Will be removed in v5.0 with the rest of the compatibility mode +/// suite of tools and settings $govuk-compatibility-govuktemplate: false !default; +@if $govuk-compatibility-govuktemplate == true { + @include _warning("compatibility-mode", "$govuk-compatibility-govuktemplate " + + "is deprecated. From version 5.0, GOV.UK Frontend will remove " + + "compatibility with the legacy library govuk_template."); +} + /// Compatibility Mode: alphagov/govuk_elements /// /// Enabling this will: @@ -56,9 +72,17 @@ $govuk-compatibility-govuktemplate: false !default; /// /// @type Boolean /// @access public +/// @deprecated Will be removed in v5.0 with the rest of the compatibility mode +/// suite of tools and settings $govuk-compatibility-govukelements: false !default; +@if $govuk-compatibility-govukelements == true { + @include _warning("compatibility-mode", "$govuk-compatibility-govukelements " + + "is deprecated. From version 5.0, GOV.UK Frontend will remove compatibility " + + "with the legacy library govuk_elements."); +} + /// Compatibility Product Map /// /// Maps product names to their settings that we can use to lookup states from @@ -66,6 +90,8 @@ $govuk-compatibility-govukelements: false !default; /// /// @type Map /// @access private +/// @deprecated Will be removed in v5.0 with the rest of the compatibility mode +/// suite of tools and settings $_govuk-compatibility: ( govuk_frontend_toolkit: $govuk-compatibility-govukfrontendtoolkit,