vue-svg

Vue directive that will add a svg from an svg sprite sheet to an element.
1,219 4
Install
npm install vue-svg
Latest Version:1.0.1
License:MIT
Last Updated:Sep 24, 2015
Links: GitHub  ·  npm
Maintainer: brendanneufeld

vue-svg

experimental

A Vue directive that will add a svg from a svg sprite sheet to an element.

Usage

var fs = require('fs');
var Vue = require('vue');
Vue.use(require('vue-svg'),{
  sprite: fs.readFileSync(__dirname + 'sprites.svg', 'utf8'),
  prefix: 'svg-sprite--'
});

You will need a grunt or gulp task to concatenate your individual svgs into a single file. Sometimes these tasks will add a prefix to namespace the individual svgs. Just add this prefix to the options and use the individual file name in the directive as follows:

<div v-svg="close-icon"></div>

NPM

License

MIT, see LICENSE.md for details.

Related Packages

vue-svg-sprite

Vue.js plugin, component and directive to simply use SVG sprite

120,140 59
nuxt-svg-sprite-module

A quick and dirty way to inline svg sprites in your Nuxt app.

3,180 20
rollup-plugin-vue-inline-svg

convert svg files to optimised vue components

21,881
@eyes22798/svg-icon

a svg icon component use in vue

941 3
rollup-plugin-svg-sprites

Rollup plugin for creating SVG sprites.

16,919

Version History

Version Released License
1.0.1 MIT
1.0.0 MIT