vue-svg2-loader
v0.5.0
Published
Use SVG files as Vue Components
Downloads
2
Maintainers
Readme
vue-svg-loader
A webpack loader that allows to use SVG files as Vue Components.
Installation
npm i vue-svg2-loader -D
Configuration
{
test: /\.svg$/,
loader: 'vue-svg2-loader', // `vue-svg` for webpack 1.x,
options: {
classes: 'default-class-1 default-class-2'
}
}
Example code
<template>
<nav id="menu">
<a href="...">
<SomeIcon class="icon" />
Some page
</a>
</nav>
</template>
<script>
import SomeIcon from './assets/some-icon.svg';
export default {
name: 'menu',
components: {
SomeIcon,
},
};
</script>
The idea behind this was inspired by react-svg-loader.