JSPM

vue-svg-component-builder

2.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1313
  • Score
    100M100P100Q103900F
  • License MIT

Factory function for creating Vue components for SVG images

Package Exports

  • vue-svg-component-builder
  • vue-svg-component-builder/lib/utils

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-svg-component-builder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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)
  }
})