svg-to-vue
Utility to convert SVG code into Vue component definition
Last updated 5 years ago by visualfanatic .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install svg-to-vue 
SYNC missed versions from official npm registry.

svg-to-vue

Utility to convert SVG code into Vue component definition

Instalation

npm i svg-to-vue vue-template-compiler

yarn add svg-to-vue vue-template-compiler

Usage

const svgToVue = require('svg-to-vue');

const code = `
  <svg width="300" height="200" xmlns="http://www.w3.org/2000/svg">
    <rect width="100%" height="100%" fill="red" />
  </svg>
`;

svgToVue(code)
  .then((component) => {
    // `component` contains Vue component definition
    console.log(component);
  });

API

svgToVue(code, {
  svgoConfig: {
    plugins: [
      {
        prefixIds: true,
      },
    ],
  },
  svgoPath: 'some/path/to.svg',
});
Name Type Default value Description
svgoConfig Object/Boolean {} Configuration object passed to SVGO or false to disable optimization
svgoPath String null Path to SVG file which is used by SVGO prefixIds plugin to generate unique IDs

Current Tags

  • 0.7.0                                ...           latest (5 years ago)
  • 0.4.0-alpha.1                                ...           next (6 years ago)

9 Versions

  • 0.7.0                                ...           5 years ago
  • 0.6.0                                ...           5 years ago
  • 0.5.0                                ...           5 years ago
  • 0.4.0                                ...           6 years ago
  • 0.4.0-alpha.1                                ...           6 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.1                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |