Skip to content

Instantly share code, notes, and snippets.

@Camwyn
Created November 2, 2016 14:55
Show Gist options
  • Select an option

  • Save Camwyn/b1e9241aa45788b94843c9c8adfd23de to your computer and use it in GitHub Desktop.

Select an option

Save Camwyn/b1e9241aa45788b94843c9c8adfd23de to your computer and use it in GitHub Desktop.
Mixin for creating svg icons
/**
* Icon
* Allows easy insertion of an svg icon.
*
* $icon-name: name of the icon used in the symbol-defs (needs quotes)
* $fill: icon fill color
* $property: background-image or content?
* example: @include icon('cross', '#000', content);
*/
@mixin icon($icon-name, $fill: false, $property: background-image) {
#{$property}: url('../svg/symbol-defs.svg#icon-#{$icon-name}');
@if false != $fill {
fill: $fill;
}
@content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment