Adjusted error handling in px2em

This commit is contained in:
squidfunk 2016-09-08 22:29:26 +02:00
parent f5ad733181
commit 841b493df6
2 changed files with 12 additions and 16 deletions

View File

@ -35,9 +35,13 @@
/// ///
@function px2em($size, $base: 16px) { @function px2em($size, $base: 16px) {
@if unit($size) == px { @if unit($size) == px {
@return ($size / $base) * 1.0em; @if unit($base) == px {
@return ($size / $base) * 1.0em;
} @else {
@error "Invalid base: #{$base} - unit must be 'px'";
}
} @else { } @else {
@error "Invalid unit: #{$size} - must be px"; @error "Invalid size: #{$size} - unit must be 'px'";
} }
} }
@ -52,8 +56,12 @@
/// ///
@function px2rem($size, $base: 10px) { @function px2rem($size, $base: 10px) {
@if unit($size) == px { @if unit($size) == px {
@return ($size / $base) * 1.0rem; @if unit($base) == px {
@return ($size / $base) * 1.0rem;
} @else {
@error "Invalid base: #{$base} - unit must be 'px'";
}
} @else { } @else {
@error "Invalid unit: #{$size} - must be px"; @error "Invalid size: #{$size} - unit must be 'px'";
} }
} }

View File

@ -1,12 +0,0 @@
// ----------------------------------------------------------------------------
// Theme colors
// ----------------------------------------------------------------------------
// Headlines
// $md-theme-h1-color: $md-color-black--light;
// $md-theme-h2-color: $md-color-black;
// $md-theme-h3-color: $md-color-black;
// $md-theme-h4-color: $md-color-black;
// $md-theme-h5-6-color: $md-color-black--light;
//
// $md-theme-hr-color: $md-color-black--lighter;