Skip to content

Experience-Monks/vue-svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published