Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/excalidraw/svg-to-excalidraw

Convert SVGs into Excalidraw data
https://github.com/excalidraw/svg-to-excalidraw

Last synced: 4 months ago
JSON representation

Convert SVGs into Excalidraw data

Lists

README

        

# svg-to-excalidraw

Library to convert SVG to Excalidraw’s file format.

## :floppy_disk: Installation

```bash
yarn add svg-to-excalidraw
```

## :beginner: Usage

```typescript
import svgToEx from "svg-to-excalidraw";

const heartSVG = `

`;

const { hasErrors, errors, content } = svgToEx.convert(heartSVG);

// SVG parsing errors are propagated through.
if (hasErrors) {
console.error(errors);
return;
}

navigator.clipboard.writeText(content);

// the heart excalidraw json is now copied to your clipboard.
// Just Paste it into your Excalidraw session!
```

## :game_die: Running tests

TODO.

### :building_construction: Local Development

#### Building the Project

```bash
yarn build

# Build and watch whenever a file is updated
yarn build:watch
```

## :busts_in_silhouette: Contributing

Pull requests are welcome. For major changes, please [open an issue](https://github.com/excalidraw/svg-to-excalidraw/issues) first to discuss what you would like to change.