# svg-to-vue

> Utility to convert SVG code into Vue component definition

Latest version **0.7.0** (published 2020-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install svg-to-vue
pnpm add svg-to-vue
yarn add svg-to-vue
bun add svg-to-vue
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2020-02-10 |
| First published | 2018-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.4 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 31 |
| Author | Damian Stasik |
| Maintainers | visualfanatic |
| Keywords | vue, svg, svgo |

## Links

- npm: https://www.npmjs.com/package/svg-to-vue
- Repository: https://github.com/visualfanatic/svg-to-vue
- Homepage: https://github.com/visualfanatic/svg-to-vue#readme
- Issues: https://github.com/visualfanatic/svg-to-vue/issues
- npm.io page: https://npm.io/package/svg-to-vue

## Dependencies (1)

- [svgo](https://npm.io/package/svgo.md) ^1.3.2

## Recent versions

- 0.7.0 (latest) — 2020-02-10
- 0.4.0-alpha.1 (next) — 2018-11-25
- 0.6.0 — 2019-11-11
- 0.5.0 — 2019-11-06
- 0.4.0 — 2019-02-05
- 0.3.0 — 2018-10-11
- 0.2.1 — 2018-09-24
- 0.2.0 — 2018-09-24
- 0.1.0 — 2018-09-24

## README

<h1 align="center">svg-to-vue</h1>
<p align="center">Utility to convert SVG code into Vue component definition</p>

## Instalation
``` bash
npm i svg-to-vue vue-template-compiler

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

## Usage
``` js
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
``` js
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 |

---
_Source: https://npm.io/package/svg-to-vue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
