Skip to content

Commit

Permalink
Added a bit of API description
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfanatic authored Oct 1, 2018
1 parent 79a1bb0 commit a567fbe
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,36 @@ yarn add svg-to-vue
``` js
const svgToVue = require('svg-to-vue');

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

svgToVue(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',
esmExport: true,
});
```

| 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 |
| `esmExport` | `Boolean` | `false` | Module export format: `true` for EcmaScript or `false` for CommonJS |

0 comments on commit a567fbe

Please sign in to comment.