Skip to content

Commit

Permalink
Deprecate compatibility mode settings
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
owenatgov committed Sep 27, 2022
1 parent 8f370c2 commit ecb4b15
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/assets/scss/app-legacy-ie8.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ $govuk-compatibility-govukfrontendtoolkit: true;
$govuk-compatibility-govuktemplate: true;
$govuk-compatibility-govukelements: true;

// Specify that the current stylesheet is the local legacy review app to suppress
// deprecation warnings
$_govuk-is-legacy-review-app: true;

// Set Elements assets path
$path: "/vendor/govuk_frontend_toolkit/assets/";

Expand Down
4 changes: 4 additions & 0 deletions app/assets/scss/app-legacy.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ $govuk-compatibility-govukfrontendtoolkit: true;
$govuk-compatibility-govuktemplate: true;
$govuk-compatibility-govukelements: true;

// Specify that the current stylesheet is the local legacy review app to suppress
// deprecation warnings
$_govuk-is-legacy-review-app: true;

// Set Elements assets path
$path: "/vendor/govuk_frontend_toolkit/assets/";

Expand Down
45 changes: 45 additions & 0 deletions src/govuk/settings/_compatibility.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,41 @@
/// @group settings/compatibility
////

/// Stylesheet is the legacy "review app"
///
/// Whether the stylesheet being built is the local legacy "review app", intended
/// for testing GOV.UK Frontend with compatibility mode variables active.
///
/// This variable is a temporary way to suppress deprecation warnings for the
/// compatibility mode variables and should not be set outside of app-legacy.scss
/// and app-legacy-ie8.scss in the local app.
///
/// @type Boolean
/// @access private
/// @deprecated Will be removed in v5.0 with the rest of the compatibility mode
/// suite of tools and settings

$_govuk-is-legacy-review-app: false !default;

/// Compatibility Mode: alphagov/govuk_frontend_toolkit
///
/// Set this to true if you are also including alphagov/govuk_frontend_toolkit
/// in your application.
///
/// @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 and
$_govuk-is-legacy-review-app == false {
@warn "$govuk-compatibility-govukfrontendtoolkit is deprecated. " +
"From version 5.0, GOV.UK Frontend will not support compatibility with the " +
"legacy codebase govuk_frontend_toolkit";
}

/// Compatibility Mode: alphagov/govuk_template
///
/// Enabling this will:
Expand All @@ -41,9 +66,18 @@ $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 and
$_govuk-is-legacy-review-app == false {
@warn "$govuk-compatibility-govuktemplate is deprecated. " +
"From version 5.0, GOV.UK Frontend will not support compatibility with the " +
"legacy codebase govuk_template";
}

/// Compatibility Mode: alphagov/govuk_elements
///
/// Enabling this will:
Expand All @@ -56,16 +90,27 @@ $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 and
$_govuk-is-legacy-review-app == false {
@warn "$govuk-compatibility-govukelements is deprecated. " +
"From version 5.0, GOV.UK Frontend will not support compatibility with the " +
"legacy codebase govuk_elements";
}

/// Compatibility Product Map
///
/// Maps product names to their settings that we can use to lookup states from
/// within the `@govuk-compatibility` mixin.
///
/// @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,
Expand Down

0 comments on commit ecb4b15

Please sign in to comment.