Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Phunky/v-svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

v-svg

VueJS 2 component for making SVG sprites simpler to use.

Setup

import svg from 'vue-svg-directive'
// ...
Vue.use(svg, {
  filepath: '/static/sprites.svg', // Optional filepath to your svg sprite
  prefix: 'icon-',  // Optional prefix for all your sprite names
  class: 'icon', // Optional class that will be applied to the <svg> element (optional)
  size: '32' // Optional default size value
});

Usage

<v-svg sprite="home"></div>

The size attribute gives you the ability to change the viewBox value.

<!--// viewBox="0 0 32 32 "//-->
<svg v-svg sprite="home" size="32"></svg>
<!--// viewBox="0 0 32 64 "//-->
<svg v-svg sprite="home" size="32 64"></svg>
<!--// viewBox="5 5 32 64 "//-->
<svg v-svg sprite="home" size="5 5 32 64"></svg>

Releases

No releases published

Packages

No packages published