A Web3-inspired SVG transpiler that minimizes SVG code for blockchain/NFT use, version 1.4.0. It converts SVG into a compact token format (tinySVG) suitable for smart contract storage, with optional LZ compression. Key differentiators: designed for NFT contracts (InfinityMint), separates colors from paths, allows programmatic whitelist/blacklist of SVG tags. Aims to reduce gas costs. Also supports converting tinySVG back to SVG. Ships TypeScript types. Release history sparse; primarily maintained by 0x0zAgency.
npm install tinysvg-jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates converting an SVG string to TinySVG format (with optional compression) and back to SVG.
Capture the third return value (colours) and persist it alongside the tiny SVG code.
Be aware that the resulting tiny SVG will not contain colour info; use the colours array to reapply colours when converting back.
Use import { tinySVG } from 'tinysvg-js' instead of require or default import.Ensure lz-string is installed if you plan to decompress: npm install lz-string
Change to: import { tinySVG } from 'tinysvg-js';Use ES module import syntax or ensure your project is set up for ESM.
Ensure the input is exactly as produced by toTinySVG (including leading '/' and bracket structure). Test with a known working output first.