1
0
mirror of https://github.com/svg/svgo.git synced 2025-08-04 17:02:08 +03:00
Files
svgo/docs/02-usage/01-node.mdx
2025-05-05 17:27:55 +01:00

25 lines
676 B
Plaintext

---
title: Node.js
slug: 'node'
---
To minimally use SVGO in Node.js, ensure you've installed the dependency by following the instructions in [Getting Started](../01-index.mdx#installation), then import the `optimize` function.
Here's a minimal example:
```js
import { optimize } from 'svgo';
const svg = `
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 100 100">
<text x="50" y="50" text-anchor="middle">•ᴗ•</text>
</svg>
`;
const { data } = optimize(svg);
console.log(data);
// <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text x="50" y="50" text-anchor="middle">•ᴗ•</text></svg>
```