Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/damianstasik/svg-to-vue
Utility to convert SVG code into Vue component definition
https://github.com/damianstasik/svg-to-vue
javascript nodejs svg vue
Last synced: 7 days ago
JSON representation
Utility to convert SVG code into Vue component definition
- Host: GitHub
- URL: https://github.com/damianstasik/svg-to-vue
- Owner: damianstasik
- License: mit
- Created: 2018-09-24T10:58:53.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T20:14:36.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T04:48:57.082Z (18 days ago)
- Topics: javascript, nodejs, svg, vue
- Language: JavaScript
- Homepage:
- Size: 487 KB
- Stars: 31
- Watchers: 1
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
svg-to-vue
Utility to convert SVG code into Vue component definition
## Instalation
``` bash
npm i svg-to-vue vue-template-compileryarn add svg-to-vue vue-template-compiler
```## Usage
``` js
const svgToVue = require('svg-to-vue');const code = `
`;// Promise
svgToVue(code)
.then((component) => {
// `component` contains Vue component definition
console.log(component);
});// Async/await
const component = await svgToVue(code);// `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 |