Created
March 19, 2015 23:32
-
-
Save MichaelArestad/a5355043258984abcae8 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.12) | |
// Compass (v1.0.3) | |
// ---- | |
/* | |
* FlowType Sass Mixin 1.1 | |
*/ | |
// Establish default settings/variables | |
// ==================================== | |
$minimum: 500; | |
$maximum: 1200; | |
$minFont: 12; | |
$maxFont: 40; | |
$fontRatio: 30; | |
// Mixin start | |
// =========== | |
@mixin flowtype($maximum, $minimum, $maxFont, $minFont, $fontRatio) { | |
$fontSize: $maxFont; | |
$tempFontSize: $fontSize; | |
// Output media query for minimum size | |
// =================================== | |
@media screen and (max-width: #{$minimum}px) { | |
font-size: #{$minFont}px; | |
} | |
// Do the magic math | |
// ================= | |
@for $i from $minimum through $maximum { | |
$fontBase: floor($i / $fontRatio); | |
@if $fontBase > $maxFont { | |
$fontSize: $maxFont; | |
} | |
@else if $fontBase < $minFont { | |
$fontSize: $minFont; | |
} | |
@else { | |
$fontSize: $fontBase; | |
} | |
// Output media queries | |
// ==================== | |
@if $tempFontSize != $fontSize { | |
@media screen and (min-width: #{$i}px) { | |
font-size: #{$fontSize}px; | |
} | |
} | |
$tempFontSize: $fontSize; | |
} | |
} | |
body { | |
@include flowtype($minimum, $maximum, $minFont, $maxFont, $fontRatio); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* FlowType Sass Mixin 1.1 | |
*/ | |
@media screen and (max-width: 1200px) { | |
body { | |
font-size: 40px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment