https://github.com/sha-red/compass-mixins/tree/master/lib
extended with more sass frameworks and as django app.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.2 KiB
57 lines
1.2 KiB
// Math Validation |
|
// =============== |
|
|
|
|
|
// Valid Columns |
|
// ------------- |
|
// Check that a column setting is valid. |
|
@function valid-columns( |
|
$columns, |
|
$silent: false |
|
) { |
|
$type: type-of($columns); |
|
$return: null; |
|
|
|
@if $type == number and unitless($columns) { |
|
$return: $columns; |
|
} @else if $type == list { |
|
$fail: null; |
|
@each $col in $columns { |
|
@if type-of($col) == number { |
|
$fail: $fail or if(unitless($col), null, true); |
|
} @else { |
|
$fail: true; |
|
} |
|
} |
|
$return: if($fail, $return, $columns); |
|
} |
|
|
|
@if $return != $columns and not($silent) { |
|
$return: null; |
|
$warn: '$columns must be a unitless number or list of unitless numbers.'; |
|
@warn $warn + ' Current value [#{$type}]: #{$columns}'; |
|
} |
|
|
|
@return $return; |
|
} |
|
|
|
|
|
// Valid Gutters |
|
// ------------- |
|
// Check that a gutter setting is valid. |
|
@function valid-gutters( |
|
$gutters, |
|
$silent: false |
|
) { |
|
$type: type-of($gutters); |
|
$return: null; |
|
|
|
@if $type == number and unitless($gutters) { |
|
$return: $gutters; |
|
} @else if not($silent) { |
|
$warn: '$gutters must be a unitless number.'; |
|
@warn $warn + ' Current value [#{$type}]: #{$gutters}'; |
|
} |
|
|
|
@return $return; |
|
}
|
|
|