Skip to content

Instantly share code, notes, and snippets.

@sagalbot
Last active February 10, 2022 13:12
Show Gist options
  • Save sagalbot/75a85fb8f57d713653df9aaa4bdacd5c to your computer and use it in GitHub Desktop.
Save sagalbot/75a85fb8f57d713653df9aaa4bdacd5c to your computer and use it in GitHub Desktop.
Super lightweight implementation of @primer/octicons as a Vue component. ex) `<icon name="alert" />`
<script>
import icons from '@pimer/octicons';
export default {
functional: true,
render(createElement, { props }) {
return Object.hasOwnProperty.apply(icons, [props.name]) ? createElement('svg', {
domProps: { innerHTML: icons[props.name].path },
attrs: { ...icons[props.name].options },
}) : false;
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment