Created
April 9, 2013 17:12
-
-
Save billinghamj/5347498 to your computer and use it in GitHub Desktop.
A better way to declare lots of font-faces
This file contains 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
@import 'compass/css3/font-face'; | |
@mixin nice-font-face($name, $directoryName, $svg, $weights, $style, $fileSuffix: '', $nameOverride: false) | |
{ | |
@each $weight in $weights | |
{ | |
$path: $directoryName + '/'; | |
$files: ''; | |
@if ($nameOverride) | |
{ | |
$path: $path + $nameOverride; | |
} | |
@else | |
{ | |
$path: $path + $weight; | |
} | |
$path: $path + $fileSuffix + '.'; | |
@if ($svg) | |
{ | |
$files: font-files($path + 'woff', woff, $path + 'ttf', ttf, $path + 'svg', svg); | |
} | |
@else | |
{ | |
$files: font-files($path + 'woff', woff, $path + 'ttf', ttf); | |
} | |
@include font-face($name, $files, $path + 'eot', $weight, $style); | |
} | |
} | |
@include nice-font-face('Proxima Nova', 'proxima-nova', false, 300 400 600 700 800 900, normal); | |
@include nice-font-face('Proxima Nova', 'proxima-nova', false, 300 400 600 700, italic, '_i'); | |
@include nice-font-face('Open Sans', 'open-sans', false, 300 400 600 700 800, normal); | |
@include nice-font-face('Open Sans', 'open-sans', false, 300 400 600 700 800, italic, '_i'); | |
@include nice-font-face('Batch', 'batch', true, 100 200 300 400 500 600 700 800 900, normal, '', 'all'); | |
@include nice-font-face('Batch', 'batch', true, 100 200 300 400 500 600 700 800 900, italic, '', 'all'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment