Skip to content

Commit

Permalink
Merge pull request #24 from ianrose/adds-slient-option
Browse files Browse the repository at this point in the history
Adds a slient option to rhythm functions
  • Loading branch information
ianrose committed Nov 17, 2014
2 parents fadc430 + 41896e8 commit 88f50e8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
8 changes: 4 additions & 4 deletions _typesettings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ $not-integer-txt: ' value breaks vertical rhythm. Use an interger (whole number)

// Returns an EM value that is a multiple of our defined base vertical unit. For
// example 3 becomes 1.125em
@function emRhythm($lines: $base-vertical-unit, $font-size: $base-em-font-size) {
@if is-int($lines) == false {
@function emRhythm($lines: $base-vertical-unit, $font-size: $base-em-font-size, $slient: false) {
@if is-int($lines) == false and $slient == false {
@warn #{$lines} + $not-integer-txt;
}
@return (stripUnits($lines) * stripUnits($base-vertical-unit)) / (stripUnits($font-size) * stripUnits($base-font-size)) + 0em;
}

// Returns a unitless number that is a multiple of our defined base vertical unit.
// For example 3 becomes 1.125
@function unitlessRhythm($lines: $base-line-multi, $font-size: $base-em-font-size) {
@if is-int($lines) == false {
@function unitlessRhythm($lines: $base-line-multi, $font-size: $base-em-font-size, $slient: false) {
@if is-int($lines) == false and $slient == false {
@warn #{$lines} + $not-integer-txt;
}
@return ($lines * stripUnits($base-vertical-unit)) / (stripUnits($font-size) * stripUnits($base-font-size));
Expand Down
5 changes: 4 additions & 1 deletion test/test.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,7 @@ hr {
padding-top: 1.4375em; }

.div {
margin-bottom: 0.45em; }
margin-bottom: 0.1125em; }

.div {
margin-bottom: 0.215625em; }
6 changes: 5 additions & 1 deletion test/test.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
@import "../typesettings";

.div {
margin-bottom: emRhythm(1.2);
margin-bottom: emRhythm(1.2, 4, true);
}

.div {
margin-bottom: emRhythm(2.3, 4, false);
}

0 comments on commit 88f50e8

Please sign in to comment.