vue-sprited-svg-loader
Simple svg sprite webpack loader for Vue to use .svg files as component. Based on svg-sprite-loader
. With typescript support.
See Demo Example.
Install
Requires svg-sprite-loader
as first loader.
npm i -D vue-sprited-svg-loader svg-sprite-loader
Webpack Loader
module: rules: test: /\.svg$/ use: 'vue-sprited-svg-loader' 'svg-sprite-loader'
Usage
Script
;; components: IconFirst IconSecond ;
Template
Usage inside Slot
By default component has slot named icon
.
VueButton.vue
App.vue
Press Me
Props
string | number
width: Append width to style in pixels
.
string | number
height: Append height to style in pixels
.
string | number
size: Append both width and height to style in pixels
.
Options
loader: 'vue-sprited-svg-loader' options: customClass: 'icon' slotName: 'icon' 'svg-sprite-loader'
string
= ''
customClass: Add custom class to component
...
string
= 'icon'
slotName: Add custom slot name to component
...