diff options
author | Martijn Cuppens <martijn.cuppens@gmail.com> | 2019-01-22 22:55:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-22 22:55:23 +0300 |
commit | 5c56e9adff6c1ab8c7ae72429e6bc33b426541f0 (patch) | |
tree | 1c22289b48ac50313a33ecc973f1595bc240ddd8 /scss | |
parent | f7e8445f72875a49a909dc0af8e4cf43f19f535e (diff) |
Add `deprecate()` mixin (#28092)
Diffstat (limited to 'scss')
-rw-r--r-- | scss/_mixins.scss | 3 | ||||
-rw-r--r-- | scss/_variables.scss | 1 | ||||
-rw-r--r-- | scss/mixins/_deprecate.scss | 10 | ||||
-rw-r--r-- | scss/mixins/_text-hide.scss | 4 |
4 files changed, 15 insertions, 3 deletions
diff --git a/scss/_mixins.scss b/scss/_mixins.scss index 8710166660..254986cdea 100644 --- a/scss/_mixins.scss +++ b/scss/_mixins.scss @@ -2,6 +2,9 @@ // // Used in conjunction with global variables to enable certain theme features. +// Deprecate +@import "mixins/deprecate"; + // Utilities @import "mixins/breakpoints"; @import "mixins/hover"; diff --git a/scss/_variables.scss b/scss/_variables.scss index c916257e78..bbd92a91aa 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -117,6 +117,7 @@ $enable-grid-classes: true !default; $enable-pointer-cursor-for-buttons: true !default; $enable-print-styles: true !default; $enable-validation-icons: true !default; +$enable-deprecation-messages: true !default; // Spacing diff --git a/scss/mixins/_deprecate.scss b/scss/mixins/_deprecate.scss new file mode 100644 index 0000000000..43d6f1ea04 --- /dev/null +++ b/scss/mixins/_deprecate.scss @@ -0,0 +1,10 @@ +// Deprecate mixin +// +// This mixin can be used to deprecate mixins or functions. +// `$enable-deprecation-messages` is a global variable, `$ignore-warning` is a variable that can be passed to +// some deprecated mixins to suppress the warning (for example if the mixin is still be used in the current version of Bootstrap) +@mixin deprecate($name, $deprecate-version, $remove-version, $ignore-warning) { + @if ($enable-deprecation-messages != false and $ignore-warning != true) { + @warn "#{$name} has been deprecated as of #{$deprecate-version}. It will be removed entirely in #{$remove-version}."; + } +} diff --git a/scss/mixins/_text-hide.scss b/scss/mixins/_text-hide.scss index 9ffab169f3..3a923011ec 100644 --- a/scss/mixins/_text-hide.scss +++ b/scss/mixins/_text-hide.scss @@ -7,7 +7,5 @@ background-color: transparent; border: 0; - @if ($ignore-warning != true) { - @warn "The `text-hide()` mixin has been deprecated as of v4.1.0. It will be removed entirely in v5."; - } + @include deprecate("`text-hide()`", "v4.1.0", "v5", $ignore-warning); } |