vue-svg-directive
v1.0.0
Published
VueJS directive to make using SVG sprites simpler
Downloads
13
Readme
vue-svg-directive
VueJS directive to make using SVG sprites much simpler to use.
Setup
import svg from 'vue-svg-directive'
// ...
Vue.use(svg, {
sprites: '/static/sprites.svg', // Path to your svg sprite
prefix: 'icon-', // The prefix all your icons have in your sprite (optional)
class: 'icon' // This class will be applied to your <svg> elements (optional)
});
Usage
The below will insert an <svg />
within it's parent element
<div v-svg sprite="home"></div>
While the below will just add the appropriate <use>
into the <svg>
<svg v-svg sprite="home"></svg>