Skip to content

Instantly share code, notes, and snippets.

@dillonbailey
Created January 31, 2016 03:18
Show Gist options
  • Save dillonbailey/f91f6079288e403492e2 to your computer and use it in GitHub Desktop.
Save dillonbailey/f91f6079288e403492e2 to your computer and use it in GitHub Desktop.
// For adding font icons to elements using CSS pseudo-elements
// http://jaydenseric.com/blog/fun-with-sass-and-font-icons
// Usage @include icon(before, email, false);
@mixin icon($position: before, $icon: false, $styles: true) {
@if $position == both {
$position: 'before, &:after';
}
// Either a :before or :after pseudo-element, or both, defaulting to :before
&:#{$position} {
@if $icon {
// A particular icon has been specified
content: "#{map-get($icons, $icon)}";
}
@if $styles {
// Supportive icon styles required
speak: none;
font-style: normal;
font-weight: normal;
font-family: 'honestfox';
// Some more supportive icon styles via icomoon.io
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
line-height: 1;
font-variant: normal;
}
// Include any extra rules supplied for the pseudo-element
@content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment