Skip to content

Instantly share code, notes, and snippets.

@cahnory
Created September 14, 2015 15:03
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 cahnory/9754e4fb5a5abd09fb1f to your computer and use it in GitHub Desktop.
Save cahnory/9754e4fb5a5abd09fb1f to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="arrow">
dsdasa
</div>
// ----
// libsass (v3.2.5)
// ----
@function svg-polygon($props) {
$fill: map-get($props, 'fill');
$points: map-get($props, 'points');
@return '<polygon fill="#{$fill}" points="#{$points}"/>';
}
@function svg($svg...) {
$res: '<svg xmlns="http://www.w3.org/2000/svg">';
@each $el in $svg {
$type: map-get($el, 'tag');
@if 'polygon' {
$res: $res + svg-polygon($el);
}
}
@return $res + '</svg>';
}
.arrow {
$svg: svg((
(
tag: polygon,
fill: green,
points: (50,100 0,0 0,100)
)
));
background-image: url('data:image/svg+xml;utf8, #{$svg}')
}
.arrow {
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg"><polygon fill="green" points="50, 100 0, 0 0, 100"/></svg>');
}
<div class="arrow">
dsdasa
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment