# svg2js

> Handy utility to convert SVG images to inline Javascript

Latest version **0.0.4-alpha1** (published 2019-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install svg2js
pnpm add svg2js
yarn add svg2js
bun add svg2js
```

## 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.0.4-alpha1 |
| Published | 2019-03-17 |
| First published | 2018-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 263.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Pavel Jacko |
| Maintainers | pavjacko |
| Keywords | app, svg, js, inline, generator |

## Links

- npm: https://www.npmjs.com/package/svg2js
- Repository: https://github.com/pavjacko/svg2js
- Homepage: https://github.com/pavjacko/svg2js#readme
- Issues: https://github.com/pavjacko/svg2js/issues
- npm.io page: https://npm.io/package/svg2js

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.4-alpha1 (latest) — 2019-03-17
- 0.0.3 — 2018-01-26
- 0.0.2 — 2018-01-26
- 0.0.1 — 2018-01-25

## README

# svg2js #

Handy utility to convert SVG images to inline Javascript


## Installation

`npm install --save svg2js`

## Usage

Svg2Js API is Promise based

#### Usage 1 (Save to file as Javascript Module):

```js
import Svg2Js from 'svg2js'

Svg2Js.create({
  source: '/Users/userX/myImage.svg',
  destination: '/Users/userX/myImage.js'
}).then(() => console.log('SUCCESS!'))

```

after conversion JS SVG can be used as regular JS module

```js
var MySvgImage = require('../../../../selectorAssets/runtime/icons/myImage.js')

//USE MySvgImage as inline value for rendering in various tools/libs

```

#### Usage 2 (Get inline value):

```js
import Svg2Js from 'svg2js'

Svg2Js.convert({
  source: '/Users/userX/myImage.svg'
}).then((result) => console.log('SUCCESS!', result))

```



## Contributing ##

Basicaly clone, change, test, push and pull request.

## License ##

icon-toolkit is licensed under the MIT license.

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