Skip to content

Instantly share code, notes, and snippets.

@younes-dro
Created September 6, 2019 00:41
Show Gist options
  • Save younes-dro/f9ea9ac8504f80fe033b109c92cbde0f to your computer and use it in GitHub Desktop.
Save younes-dro/f9ea9ac8504f80fe033b109c92cbde0f to your computer and use it in GitHub Desktop.
generate custom widget glyph icon using Sass : loop , mixin , map
@mixin sidebar-title-icon($content){
.widget-title{
&::before{
font-family: "Ionicons";
content: $content;
display: inline-block;
margin: 0 10px 0 0;
}
}
}
$widgets : (
"archive":"\f134",
"tag_cloud":"\f377",
"categories":"\f26c",
"search":"\f4a5",
"calendar":"\f3f4",
"recent_comments":"\f11e",
"text":"\f12e",
"nav_menu":"\f394",
"recent_entries":"\f37e",
"meta":"\f48d",
"pages":"\f381") ;
@each $widget , $glyph in $widgets{
.widget_#{$widget}{
@include sidebar-title-icon($glyph);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment