Last active
January 25, 2018 15:42
-
-
Save sutter/5f9471f95f6d5f388704721272b4a21e to your computer and use it in GitHub Desktop.
_template-font-custom.scss
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
@font-face { | |
font-family: '<%= fontName %>'; | |
src: url('<%= fontName %>.woff2') format('woff2'), | |
url('<%= fontName %>.woff') format('woff'); | |
} | |
%icon { | |
position: relative; | |
display: inline-block; | |
font-family: 'app-font'; | |
font-weight: normal; | |
font-style: normal; | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
line-height: 1; | |
vertical-align: text-bottom; | |
text-decoration: inherit; | |
text-transform: none; | |
speak: none; | |
} | |
@function icon-char($filename) { | |
$char: ''; | |
<% _.each(glyphs, function(glyph) { %> | |
@if $filename == <%= glyph.fileName %> { | |
$char: '\<%= glyph.codePoint %>'; | |
}<% }); | |
%> | |
@return $char; | |
} | |
@mixin icon($filename) { | |
content: icon-char($filename); | |
} | |
.icon { | |
@extend %icon; | |
} | |
/** | |
* Modifier : Picture | |
* --------------------------------------- */ | |
<% _.each(glyphs, function(glyph) { %> | |
.icon--<%= glyph.fileName %> { | |
&::before { | |
@include icon(<%= glyph.fileName %>); | |
} | |
} | |
%icon--<%= glyph.fileName %> { | |
@include icon(<%= glyph.fileName %>); | |
} | |
<% }); %> | |
/** | |
* Modifier : push | |
* --------------------------------------- */ | |
.icon--mLeft { | |
margin-left: 10px; | |
} | |
.icon--mRight { | |
margin-right: 10px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment