Sha256: 24bf2360141e5193a8695cf934c7b34c9eec57cd839264048a91daf7d93668e8

Contents?: true

Size: 1.97 KB

Versions: 94

Compression:

Stored size: 1.97 KB

Contents

////
/// @group settings/warnings
////

/// Suppressed warnings map
///
/// This map is used to determine which deprecation warnings to **not** show
/// to users when compiling sass. This is in place for codebases that do not
/// have the necessary capacity to upgrade and remove the deprecation,
/// particularly if the deprecation is significant. For example, removal of
/// compatibility with legacy libraries such as govuk_elements.
///
/// You can add to this map and define which warnings to suppress by appending to
/// it using the warning key, found in the warning message. For example:
///
/// @example scss:
///   // warning message:
///   //  $foobar is no longer supported. To silence this warning, update
///   //  $govuk-suppressed-warnings with key: "foobar"
///   $govuk-suppressed-warnings: (
///     foobar
///   );
///
/// @type List
/// @access public

$govuk-suppressed-warnings: () !default;

/// Warnings
///
/// Acts as a wrapper for the built in `@warn` sass function
///
/// We use this instead of using `@warn` for 3 reasons:
///
/// - To check if a warning is being suppressed through `$govuk-suppressed-warnings`,
/// in which case we don't call `@warn` and printing the warning to the user
/// - To format the passed warning `$message` with the warning key at the end
/// - To prevent duplicate warnings by adding the passed `$key` to
/// `$govuk-suppressed-warnings` after `@warn` is called to ensure it only runs
/// once per sass compilation
///
/// @param {String} $key - The key to be checked against `$govuk-suppressed-warnings`
/// and then passed to it to prevent multiple of the same warning.
/// @param {String} $message - The message to use when calling `@warn`
/// @access private

@mixin _warning($key, $message) {
  @if not index($govuk-suppressed-warnings, $key) {
    @warn $message + " To silence this warning, update $govuk-suppressed-warnings " +
      "with key: \"#{$key}\"";
    $govuk-suppressed-warnings: append($govuk-suppressed-warnings, $key) !global;
  }
}

Version data entries

94 entries across 94 versions & 4 rubygems

Version Path
govuk_tech_docs-3.5.0 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_tech_docs-3.4.5 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-37.3.1 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-37.3.0 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-37.2.4 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-37.2.3 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-37.2.2 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-37.2.1 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-37.2.0 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-37.1.1 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-37.1.0 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-37.0.0 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-36.1.0 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-36.0.3 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-36.0.2 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-36.0.1 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-36.0.0 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-35.23.0 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-35.22.0 node_modules/govuk-frontend/govuk/settings/_warnings.scss
govuk_publishing_components-35.21.4 node_modules/govuk-frontend/govuk/settings/_warnings.scss