vue-svg
v1.0.1
Published
Vue directive that will add a svg from an svg sprite sheet to an element.
Downloads
65
Maintainers
Readme
vue-svg
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>
License
MIT, see LICENSE.md for details.