svg

svgps

Svg Parser

Showing:

Popularity

Downloads/wk

1

GitHub Stars

9

Maintenance

Last Commit

1mo ago

Contributors

0

Package

Dependencies

2

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

svgps

npm License

SVG Parser

Install

npm install svgps

Usage

getFormattedName

import { getFormattedName } from "svgps";

getFormattedName("Green Apple.svg");

// "green-apple"

getPaths

import { parse } from "svgps";

parse(`<svg>...</svg>`);
// Output
{
  "paths": ["M204.8,0 ...", "M0,0 ...", "M50.56,0 ..."],
  "fills": ["#41B883", "#41B883", "#35495E"],
  "width": 256,
  "height": 221,
  "viewBox": "0 0 256 221"
}

CLI

Install Globally

npm install -g svgps

Usage

Syntax

svgps <input-dir-path> <output-dir-path>

Sample

svgps /home/my-project/assets/icons /home/my-project/src

Output

// FILE: /home/my-project/src/icons.json
{
  "green-apple": {
    "paths": ["M204.8,0 ...", "M0,0 ...", "M50.56,0 ..."],
    "fills": ["#41B883", "#41B883", "#35495E"],
    "width": 256,
    "height": 221,
    "viewBox": "0 0 256 221"
  }
}

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100