Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@function rhythm behaves differently than compass #69

Open
jasunde opened this issue Oct 12, 2015 · 0 comments
Open

@function rhythm behaves differently than compass #69

jasunde opened this issue Oct 12, 2015 · 0 comments

Comments

@jasunde
Copy link

jasunde commented Oct 12, 2015

When using $font-unit: 1rem the rhythm function still outputs a calculation like what is need when using ems for the rhythm unit. I'm a n00b here so I'm not sure the proper way to make this suggestion:

// Calculate rhythm units.
@function rhythm(
$lines: 1,
$font-size: $base-font-size,
$offset: 0
) {
@if not($relative-font-sizing) and $font-size != $base-font-size {
@warn "$relative-font-sizing is false but a relative font size was passed to the rhythm function";
}

// Suggestion //
@if $font-unit == 1rem {
$font-size: $font-unit;
}

$rhythm: $font-unit * ($lines * $base-line-height - $offset) / $font-size;
// Round the pixels down to nearest integer.
@if unit($rhythm) == px {
$rhythm: floor($rhythm);
}
@return $rhythm;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant