0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Utility API improvement: use $key/$value instead of nth (#28828)

Co-Authored-By: Martijn Cuppens <martijn.cuppens@gmail.com>
This commit is contained in:
Ashfahan Khan 2019-05-30 20:22:06 +05:00 committed by Martijn Cuppens
parent fd21354de2
commit 41fcd13d3e
2 changed files with 3 additions and 4 deletions

View File

@ -53,7 +53,6 @@
@return $map; @return $map;
} }
// Replace `$search` with `$replace` in `$string` // Replace `$search` with `$replace` in `$string`
// Used on our SVG icon backgrounds for custom forms. // Used on our SVG icon backgrounds for custom forms.
// //

View File

@ -8,7 +8,7 @@
$values: zip($values, $values); $values: zip($values, $values);
} }
@each $value in $values { @each $key, $value in $values {
$properties: map-get($utility, property); $properties: map-get($utility, property);
// Multiple properties are possible, for example with vertical or horizontal margins or paddings // Multiple properties are possible, for example with vertical or horizontal margins or paddings
@ -21,12 +21,12 @@
$property-class: if($property-class, $property-class, nth($properties, 1)); $property-class: if($property-class, $property-class, nth($properties, 1));
// Don't prefix if value key is null (eg. with shadow class) // Don't prefix if value key is null (eg. with shadow class)
$property-class-modifier: if(nth($value, 1), "-" + nth($value, 1), ""); $property-class-modifier: if($key, "-" + $key, "");
.#{$property-class + $infix + $property-class-modifier} { .#{$property-class + $infix + $property-class-modifier} {
@each $property in $properties { @each $property in $properties {
// stylelint-disable-next-line declaration-no-important // stylelint-disable-next-line declaration-no-important
#{$property}: #{nth($value, 2)} !important; #{$property}: $value !important;
} }
} }
} }