Skip to content

Instantly share code, notes, and snippets.

@sutter
Last active January 25, 2018 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sutter/5f9471f95f6d5f388704721272b4a21e to your computer and use it in GitHub Desktop.
Save sutter/5f9471f95f6d5f388704721272b4a21e to your computer and use it in GitHub Desktop.
_template-font-custom.scss
@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