svg_pathify

0.0.8 • Public • Published

svgPathify

a node lib to turn svg shape elements into path svg elements

install

npm install svg_pathify

usage

var svgPathify = require('svg_pathify');
 
var result = svgPathify('<circle cx="500" cy="500" r="20" fill="red"/>');
 
/*
<path d="M500,500,m-20,0,a20,20,0,1,0,40,0,a20,20,0,1,0,-40,0,Z" fill="red"/>
*/
 
 
result = svgPathify('<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="1000" viewBox="10 10 1000 1000"><circle cx="500" cy="500" r="20" fill="red"/><circle cx="500" cy="500" r="20" fill="red"/></svg>');
 
/*
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="1000" viewBox="10 10 1000 1000">
  <path d="M500,500,m-20,0,a20,20,0,1,0,40,0,a20,20,0,1,0,-40,0,Z" fill="red"/>
  <path d="M500,500,m-20,0,a20,20,0,1,0,40,0,a20,20,0,1,0,-40,0,Z" fill="red"/>
</svg>
*/

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i svg_pathify

    Weekly Downloads

    276

    Version

    0.0.8

    License

    none

    Unpacked Size

    6.46 kB

    Total Files

    6

    Last publish

    Collaborators

    • purplebamboo