Files
DefinitelyTyped/types/svgo/svgo-tests.ts
2018-05-07 14:53:58 -07:00

32 lines
725 B
TypeScript

import SVGO from "svgo";
// Various constructor options.
let svgo = new SVGO();
svgo = new SVGO({});
svgo = new SVGO({ plugins: [] });
svgo = new SVGO({ plugins: [{ cleanupAttrs: {} }] });
svgo = new SVGO({ datauri: "base64" });
svgo = new SVGO({ floatPrecision: 2 });
svgo = new SVGO({ full: true });
// SVGO options
const options: SVGO.Options = {
plugins: [],
datauri: "enc",
floatPrecision: 2,
full: true,
js2svg: {
indent: 2,
pretty: true,
},
svg2js: {
trim: true,
}
};
svgo = new SVGO(options);
// SVGO instance methods
svgo.optimize(`<?xml version="1.0" encoding="utf-8"?><svg></svg>`, { path: "filepath" })
.then(result => result.data, error => error);