svg2svelte

Crates.iosvg2svelte
lib.rssvg2svelte
version0.2.3
sourcesrc
created_at2022-08-24 00:51:44.558032
updated_at2022-08-25 19:41:13.401647
descriptionEasily turn an SVG file into a Svelte component, Rewritten in Rust.
homepage
repositoryhttps://github.com/derektata/svg2svelte-rs
max_upload_size
id651422
size146,846
Derek Tata (derektata)

documentation

README

svg2svelte-rs

svg2svlete

Easily turn an SVG file into a Svelte component, Rewritten in Rust.

How it works

svg2svelte parses the svg file's ids for bind: in the name and converts them into variables we can manipulate later on with an animation library (e.g. anime.js)

Dependencies

  • svgo will need to be installed globally
npm i -g svgo           # npm
yarn global add svgo    # yarn
pnpm add -g svgo        # pnpm

Installation

build from source

git clone https://github.com/derektata/svg2svelte-rs
cd svg2svelte-rs
make

using cargo

cargo install svg2svelte

Usage

USAGE:
    svg2svelte [OPTIONS] [SVG_FILE]

ARGS:
    <SVG_FILE>    File to be processed

OPTIONS:
    -h, --help          Print help information
    -t, --typescript    Create a Typescript component
    -v, --verbose       Print the generated component to stdout
    -V, --version       Print version information

EXAMPLES:
    svg2svelte ball.svg
    svg2svelte -t ball.svg

Why?

The previous implementation I had written up in shell had issues running cross-platform and only worked on Linux, so I decided to start learning more Rust and this project was born.

Commit count: 30

cargo fmt