Joined August 2014
·
Posted to
Easy embedding of web fonts using a SASS mixin
over 1 year
ago
hi , can i add the include sentence in the fontface file and use it in my css file ?
hi , can i add the include sentence in the fontface file and use it in my css file ?
@mixin fontFace($family,$src,$weight: normal,$style: normal) {
@font-face {
font-family: $family;
src: url('#{$src}.eot'); // IE9 compat
src: url('#{$src}.eot?#iefix') format('embedded-opentype'), // IE8 and below
url('#{$src}.woff') format('woff'), // standards
url('#{$src}.ttf') format('truetype'), // Safari, Android, iOS
url('#{$src}.svg##{$family}') format('svg'); // legacy iOS
}
@include fontFace('MyaFont','font/myafont');
@include fontFace('MybFont','font/mybfont');
mycss.file
@import 'fontface';
body{font-family:MyaFont;}
h1{font-family:MybFont;}