How to batch svg viewbox standardization with automation scripts
- Step 1Install dependencies — npm install axios glob fs-extra — axios for the API, glob to find SVG files, fs-extra for file operations.
- Step 2Write the batch script — Use glob to collect all *.svg files, POST each to the JAD ViewBox Fixer API endpoint with your target viewBox parameter, and write the response body to your output folder.
- Step 3Add to package.json — Add a scripts entry: 'normalize-icons': 'node scripts/normalize-viewbox.js src/icons dist/icons' and run it as part of your prebuild step.
Frequently asked questions
How do I rescale paths when changing the target viewBox?+
The API includes a rescalePaths option. When set to true, all path data is scaled proportionally to fit the new coordinate space, so icons look identical regardless of the target viewBox dimensions.
Can I run the normalization in a GitHub Actions workflow?+
Yes. Add the npm script to your CI workflow steps. The action runs on ubuntu-latest with Node.js installed — no additional setup needed. Use artifact upload to store the normalized icons for downstream jobs.
What happens to SVGs that already have the correct viewBox?+
The API returns them unchanged. The script checks the response's modified: false flag and skips writing those files, making reruns idempotent.
Is there a rate limit on the API for batch processing?+
Free tier: 60 requests/minute. Pro tier: 600 requests/minute. Developer tier: unlimited. For libraries with thousands of icons, use concurrency limiting (p-limit library recommended) to stay within limits.
Privacy first
Every JAD SVG tool runs entirely in your browser using the DOM API and Canvas. Your SVG files never leave your device — verified by zero outbound network requests during processing.