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

Add $offset parameter to rhythm() function. #848

Merged
merged 1 commit into from
Apr 16, 2012
Merged

Add $offset parameter to rhythm() function. #848

merged 1 commit into from
Apr 16, 2012

Conversation

JohnAlbin
Copy link
Contributor

I was writing a mixin that needed to subtract a couple pixels from the vertical rhythm margin, just like the rhythm borders mixins do.

And then I noticed the math the rhythm border mixins are using is almost identical to the math in the rhythm() function.

Keeping with DRY, I'd like to propose we add an $offset parameter to the rhythm() function.

Then I can use rhythm() in my mixin instead of copy/pasting/rewriting lines of code from the rhythm borders mixins.

Note that the $offset parameter is totally backwards compatible with existing usage of the rhythm() function. No one's existing Sass should be affected.

@mirisuzanne
Copy link
Member

Love it. +1

@ry5n
Copy link
Contributor

ry5n commented Apr 14, 2012

Awesome! Would be handy in other cases, eg. creating a mixin that shifts an element 'out of phase' (like a heading with more space above and correspondingly less space below) while maintaining the rhythm.

@@ -112,11 +112,12 @@ $base-half-leader: $base-leader / 2;
@function rhythm(
$lines: 1,
$font-size: $base-font-size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing a comma at the end of this line.

@JohnAlbin
Copy link
Contributor Author

And I added a semi-colon after $offset: 0! Not sure how I managed both of those errors. :-p

Fixed them up and pushed a new commit.

mirisuzanne added a commit that referenced this pull request Apr 16, 2012
Add $offset parameter to rhythm() function.
@mirisuzanne mirisuzanne merged commit 0e2a5d7 into Compass:stable Apr 16, 2012
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

Successfully merging this pull request may close these issues.

3 participants