This inliner is used by me in several projects to inline SVG's in HTML (it prevents stutter and decreases the amount of requests!). It can also be used to clean SVG's.
var inliner = require("node-svg-inliner")(options);
var parsedsvg = inliner("path/to/a/svg/file");
baseDirectory
(default__dirname
): the directory from which the inliner works relative toallowedTags
(default["p", "svg", "g", "path", "polygon", "rect"]
): the allowed SVG tags the inliner outputsallowedAttributes
(default["id", "fill", "points", "class", "d", "viewBox", "width", "height", "x", "y", "style", "transform"]
): the allowed SVG attributes the inliner outputscache
(defaulttrue
): allow the inliner to cache processed SVG's in memory until the files changeremoveNewLines
(defaultfalse
): set if the SVG should come out with no newlines and as little whitespace as possible