JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 840
  • Score
    100M100P100Q128094F
  • License MIT

Package Exports

  • path-that-svg

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (path-that-svg) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Path that SVG!

Sometimes is useful to have an svg done with paths instead of elements
such as rect, circle, ellipse, line, polyline or polygon.
Like when you apply Compound Path in Adobe Illustrator.

Install

yarn add path-that-svg

Usage

String|Buffer svg

const svgToPath = require('path-that-svg')

fs.readFile('./elements.svg', (err, input) => {
  svgToPath(input).then(convertedFromBuffer => {
    console.log({ convertedFromBuffer })
  })
})

svgToPath(`<svg viewBox="0 0 500 200">
  <rect 
    x="200" 
    y="50" 
    fill="#F16362" 
    stroke="#30456B" 
    stroke-width="5" 
    stroke-linecap="round" 
    stroke-linejoin="round" 
    width="100" height="100"/>
</svg>`).then(convertedFromString => console.log({ convertedFromString }))

element-to-path Convert SVG element into path