Skip to content

Instantly share code, notes, and snippets.

@MichaelArestad
Created March 19, 2015 23:32
Show Gist options
  • Save MichaelArestad/a5355043258984abcae8 to your computer and use it in GitHub Desktop.
Save MichaelArestad/a5355043258984abcae8 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// 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);
}
/*
* 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