vue-svg-component-builder

Factory function for creating Vue components for SVG images
65,332 2
Install
npm install vue-svg-component-builder
Latest Version:2.0.3
Vue:2
License:MIT
Last Updated:Sep 24, 2019
Links: GitHub  ·  npm
Maintainer: wadetandy

vue-svg-component-builder

This is a small utility library for creating directly-renderable VueJS components from SVG images. It is primarily designed to be used as a building block for other libraries which will handle the work of actually reading and parsing the SVGs into something usable by this library.

Installation

Simply run yarn add vue-svg-component-builder or npm install vue-svg-component-builder.

Usage

This library exports a single build function which takes in an SVG and returns a view component. Currently the only accepted format for the input is the AST output of vue-component-compiler

import { build } from 'vue-svg-component-builder'
import { compile } from 'vue-component-compiler'

let svg = fs.readFileSync('filename.svg').toString()
let compiled = compile(svg)

Vue.extend({
  components: {
    TestSvg: build(compiled.ast)
  }
})

Related Packages

vue-svg-component-runtime

Runtime for supporting SVG-as-Vue Components

67,106 2
@mingcute/vue

Mingcute SVG icon components for Vue.

2,882 1,651
vue-svg-pan-zoom

Vue component for svg-pan-zoom

59,567
@jt-icons/icon-vue-components

Vue components of JT Icons collection.

2,961 1
svg-vuejs

SVG VueJS - Vue 2.0 SVG图标组件库,用于管理和使用SVG资源

1,754

Version History

Version Released License
2.0.3 MIT
2.0.2 MIT
1.1.1 MIT
1.0.4 MIT
1.0.0 MIT