1.0.12 • Published 3 years ago

svg-path-converter v1.0.12

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

svg-path-converter npm version

NPM module for converting svgs to single paths.
This can be useful for icons and other monochromatic SVGs.
<text> is currently not supported.

Initial code based on svgcrush.

Installation

npm install --save svg-path-converter

Updates

Version 1.0.12

  • Fixed bug related to trailing zeroes in path when using precision > 0 (Thanks to SkylerLipthay)
  • Changed default precision from 0 to 4

Version 1.0.11

  • Fixed path 'm' commands with more than 2 parameters
  • Fixed some <rect> elements not being converted correctly

Version 1.0.8

  • Bug fixes
  • Changed options syntax

Usage

svgToPath(svgElement, options)

import svgToPath from 'svg-path-converter';
let svg = document.querySelector("svg");
let path = svgToPath(svg);

Options

OptionTypeDefaultNote
widthFloatinput SVG widthScale output SVG to given width while preserving aspect ratio
heightFloatinput SVG heightScale output SVG to given height while preserving aspect ratio
precisionInteger4Number of digits after comma for path values

License

This project is licensed under the MIT License - see the LICENSE file for details

1.0.12

3 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago