Skip to content

Merge sibling shape elements of the same fill, stroke, alpha and mask properties into one path element.

Notifications You must be signed in to change notification settings

kfitfk/svg-shape-compressor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SVG Shape Nodes Compressor

Usage

Browser

Make sure browserify or webpack or any module loader you like is set up properly. The all-in-one bundle is not provided by now.

var svgShapeCompressor = require('svg-shape-compressor/lib/compressor_browser');
var svg = document.getElementsByTagName('svg')[0];

// The svg reference will be modified
svgShapeCompressor(svg);

Node

Use cheerio to parse the SVG DOM. Just pass in the whole SVG as a string.

var fs = require('fs');
var svgShapeCompressor = require('svg-shape-compressor/lib/compressor_node');
var svgString = fs.readFileSync('file_path.svg');

var compressedSvgString = svgShapeCompressor(svgString);

About

Merge sibling shape elements of the same fill, stroke, alpha and mask properties into one path element.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published