@oxvg/wasm
v0.0.4
Published
OXVG is an effort to create high-performance SVG tooling.
Downloads
144
Readme
Oxidised Vector Graphics for WASM
OXVG is an effort to create high-performance SVG tooling.
It's planned to include transforming, optimising, and linting, all written in Rust.
See the main readme for more!
Tools
The following are available through WASM bindings
🪶 Optimiser
An SVG optimiser similar to SVGO.
Examples
Optimise svg with the default configuration
import init, { optimise } from "@oxvg/wasm";
await init(); // must be called in browser context!
const result = optimise(`<svg />`);Or, provide your own config
import { optimise } from "@oxvg/wasm";
// Only optimise path data
const result = optimise(`<svg />`, { convertPathData: {} });Or, extend a preset
import { optimise, extend } from "@oxvg/wasm";
const result = optimise(
`<svg />`,
extend("default", { convertPathData: { removeUseless: false } }),
);You can even make use of your existing SVGO config
import { optimise, convertSvgoConfig } from "@oxvg/wasm";
import { config } from "./svgo.config.js";
const result = optimise(
`<svg />`,
convertSvgoConfig(config.plugins),
)