Skip to content

Instantly share code, notes, and snippets.

@coder618
Last active February 11, 2018 06:08
Show Gist options
  • Save coder618/5f9adfa3f8254d3a597983c24e57d390 to your computer and use it in GitHub Desktop.
Save coder618/5f9adfa3f8254d3a597983c24e57d390 to your computer and use it in GitHub Desktop.
Scss Font-Style Mixin
@mixin br-text ( $size: null, $line-h: null, $weight: null ,$c: null, $m: null, $p: null, $f-name: null, $m-b: null,$p-b : null ){
@function str-remove-whitespace($str) {
@while (str-index($str, ' ') != null) {
$index: str-index($str, ' ');
$str: "#{str-slice($str, 0, $index - 1)}#{str-slice($str, $index + 1)}";
}
@return $str;
}
@if($f-name) { font-family: $f-name; }
@if($size) {
$_size : quote($size/16 rem);
font-size: unquote(str-remove-whitespace($_size));
}
@if($line-h){
$line-h : quote($line-h/$size em);
line-height: unquote(str-remove-whitespace($line-h));
}
@if($weight) { font-weight: $weight; }
@if($c) { color: $c; }
@if($m) { margin: $m }
@if($m-b) {
$m-b : quote($m-b/$size em);
margin-bottom: unquote(str-remove-whitespace($m-b));
}
@if($p-b) {
$p-b : quote($p-b/$size em);
padding-bottom: unquote(str-remove-whitespace($p-b));
}
@if($p) { padding: $p; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment