1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-28 07:39:57 +02:00

Add RFS to utility API (#30050)

This commit is contained in:
Martijn Cuppens
2020-02-15 12:01:32 +01:00
committed by GitHub
parent 22062ed9d7
commit 1d8a3a9597
4 changed files with 40 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
// Utility generator
// Used to generate utilities & print utilities
@mixin generate-utility($utility, $infix) {
@mixin generate-utility($utility, $infix, $is-rfs-media-query: false) {
$values: map-get($utility, values);
// If the values are a list or string, convert it into a map
@@ -25,10 +25,24 @@
// Don't prefix if value key is null (eg. with shadow class)
$property-class-modifier: if($key, if($property-class == "" and $infix == "", "", "-") + $key, "");
.#{$property-class + $infix + $property-class-modifier} {
@each $property in $properties {
// stylelint-disable-next-line declaration-no-important
#{$property}: $value if($enable-important-utilities, !important, null);
@if map-get($utility, rfs) {
// Inside the media query
@if $is-rfs-media-query {
$val: rfs-value($value);
// Do not render anything if fluid and non fluid values are the same
$value: if($val == rfs-fluid-value($value), null, $val);
}
@else {
$value: rfs-fluid-value($value);
}
}
@if $value != null {
.#{$property-class + $infix + $property-class-modifier} {
@each $property in $properties {
#{$property}: $value if($enable-important-utilities, !important, null);
}
}
}
}