rel-svg-path

define a path using only relative points

Usage no npm install needed!

<script type="module">
  import relSvgPath from 'https://cdn.skypack.dev/rel-svg-path';
</script>

README

rel-svg-path

Define a path using only relative points. Most SVG drawing tools will export paths using absolute points though it can be nicer to tweak them manually when all the points are relative.

Programatic Usage

With your favourite package manager:

  • packin: packin add jkroso/rel-svg-path
  • component: component install jkroso/rel-svg-path
  • npm: npm install rel-svg-path

then in you code:

var rel = require('rel-svg-path')
rel([['M',10,20],['L',50, 40]]) // => [['m',10,20],['l',40,20]]

Command line usage

Installation:

git clone https://github.com/jkroso/rel-svg-path.git
cd rel-svg-path
make install

Then just pipe path data to it:

echo "M10 20 50 40" | rel-svg-path

Running the tests

Just run make and navigate your browser to test/index.html