Skip to content

Minifies a SVG file's path/@d attributes, useful for Data-URI-embedding in CSS.

Notifications You must be signed in to change notification settings

bikubi/svgpathminify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Reads SVG from STDIN, prints it to STDOUT with all path/@ds "minified" by rounding all coordinates to N decimals (N can be specified with the first argument, defaults to 0 (=round to integer)).
Whitespace will be omitted, too.

Example:

echo '<svg><g><path d="M 0.19970259,11.510154 C 14.134584,27.674615 8.560631,-11.343034\   
24.725093,4.2640241 40.889555,19.871082 23.052907,18.198896 23.052907,18.198896" />\   
</g></svg>' | ./svgpathminify.php 2 

Output:

<?xml version="1.0"?>
<svg><g><path d="M 0.2,11.51 C 14.13,27.67 8.56,-11.34 24.73,4.26 40.89,19.87 23.05,18.2 23.05,18.2"/></g></svg>```

About

Minifies a SVG file's path/@d attributes, useful for Data-URI-embedding in CSS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages