{"id":13418872,"url":"https://github.com/svg/svgo","last_synced_at":"2026-03-04T16:03:59.269Z","repository":{"id":4371498,"uuid":"5508088","full_name":"svg/svgo","owner":"svg","description":"⚙️ Node.js tool for optimizing SVG files","archived":false,"fork":false,"pushed_at":"2026-03-01T07:56:14.000Z","size":7350,"stargazers_count":22344,"open_issues_count":261,"forks_count":1439,"subscribers_count":237,"default_branch":"main","last_synced_at":"2026-03-01T10:47:17.380Z","etag":null,"topics":["cli","javascript","minification","nodejs","optimization","svg","svgo"],"latest_commit_sha":null,"homepage":"https://svgo.dev/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/svg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"open_collective":"svgo"}},"created_at":"2012-08-22T10:41:43.000Z","updated_at":"2026-03-01T09:59:27.000Z","dependencies_parsed_at":"2025-12-02T21:04:07.163Z","dependency_job_id":null,"html_url":"https://github.com/svg/svgo","commit_stats":{"total_commits":1388,"total_committers":224,"mean_commits":6.196428571428571,"dds":0.7456772334293948,"last_synced_commit":"c372b36296c94b7cee4f77eb0af1124d384e360f"},"previous_names":[],"tags_count":103,"template":false,"template_full_name":null,"purl":"pkg:github/svg/svgo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svg%2Fsvgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svg%2Fsvgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svg%2Fsvgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svg%2Fsvgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svg","download_url":"https://codeload.github.com/svg/svgo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svg%2Fsvgo/sbom","scorecard":{"id":861225,"data":{"date":"2025-08-11","repo":{"name":"github.com/svg/svgo","commit":"9e2029f9b101da81ef612ff7606669c71faf9085"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.4,"checks":[{"name":"Maintained","score":10,"reason":"9 commit(s) and 13 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":1,"reason":"Found 4/29 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:19","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:20","Warn: no topLevel permission defined: .github/workflows/codeql.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/main.yml:13","Warn: no topLevel permission defined: .github/workflows/spellcheck.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:77: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/spellcheck.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/spellcheck.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/spellcheck.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/svg/svgo/spellcheck.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/main.yml:58","Info:   0 out of  13 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v4.0.0-rc.4 not signed: https://api.github.com/repos/svg/svgo/releases/216673849","Warn: release artifact v4.0.0-rc.2 not signed: https://api.github.com/repos/svg/svgo/releases/216375985","Warn: release artifact v4.0.0-rc.1 not signed: https://api.github.com/repos/svg/svgo/releases/173981721","Warn: release artifact v4.0.0-rc.4 does not have provenance: https://api.github.com/repos/svg/svgo/releases/216673849","Warn: release artifact v4.0.0-rc.2 does not have provenance: https://api.github.com/repos/svg/svgo/releases/216375985","Warn: release artifact v4.0.0-rc.1 does not have provenance: https://api.github.com/repos/svg/svgo/releases/173981721"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/svg/.github/SECURITY.md:1","Info: Found linked content: github.com/svg/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/svg/.github/SECURITY.md:1","Info: Found text in security policy: github.com/svg/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":10,"reason":"SAST tool is run on all commits","details":["Info: SAST configuration detected: CodeQL","Info: all commits (30) are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-xffm-g5w8-qvg7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T01:18:59.134Z","repository_id":4371498,"created_at":"2025-08-24T01:18:59.134Z","updated_at":"2025-08-24T01:18:59.134Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30006290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T14:08:50.421Z","status":"ssl_error","status_checked_at":"2026-03-02T14:08:50.037Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","javascript","minification","nodejs","optimization","svg","svgo"],"created_at":"2024-07-30T22:01:08.201Z","updated_at":"2026-03-04T16:03:59.250Z","avatar_url":"https://github.com/svg.png","language":"JavaScript","funding_links":["https://opencollective.com/svgo"],"categories":["JavaScript","Images","Imagens","Repository","JavaScript (71)","SVG","Compression","\u003e 10k ★","前端开发框架及项目","awesome CLI 🔧","cli","The AWESOME list","Tools","\u003ca name=\"graphics\"\u003e\u003c/a\u003eGraphics","Testing \u0026 Optimization","Software","Uncategorized","Converter","Miscellaneous Tools"],"sub_categories":["Emoji","Best practices","Melhores práticas","Image","Meetups","其他_文本生成、文本对话","开发者必备 🚀","Front-end","Image Optimization","Image \u0026 SVG optimization and manipulation","Vector Utilities","Uncategorized","Progressive Web Apps (PWA)"],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./logo/logo-web.svg\" width=\"348.61\" height=\"100\" alt=\"\"/\u003e\n\u003c/div\u003e\n\n# SVGO [![npm](https://img.shields.io/npm/v/svgo)](https://npmjs.org/package/svgo) [![chat](https://img.shields.io/discord/815166721315831868)](https://discord.gg/z8jX8NYxrE) [![docs](https://img.shields.io/badge/docs-svgo.dev-blue)](https://svgo.dev/)\n\nSVGO, short for **SVG O**ptimizer, is a Node.js library and command-line application for optimizing SVG files.\n\n## Why?\n\nSVG files, especially those exported from vector editors, usually contain a lot of redundant information. This includes editor metadata, comments, hidden elements, default or suboptimal values, and other stuff that can be safely removed or converted without impacting rendering.\n\n## Installation\n\nYou can install SVGO globally through npm, yarn, or pnpm. Alternatively, drop the global flag (`global`/`-g`) to use it in your Node.js project.\n\n```sh\n# npm\nnpm install -g svgo\n\n# yarn\nyarn global add svgo\n\n# pnpm\npnpm add -g svgo\n```\n\n## Command-line usage\n\nProcess single files:\n\n```sh\nsvgo one.svg two.svg -o one.min.svg two.min.svg\n```\n\nProcess a directory of files recursively with `-r`/`--recursive` and `-f`/`--folder`:\n\n```sh\nsvgo -rf path/to/directory_with_svgs -o path/to/output_directory\n```\n\nHelp for advanced usage:\n\n```sh\nsvgo --help\n```\n\n## Configuration\n\nSVGO has a plugin architecture. You can read more about all plugins in [Plugins | SVGO Documentation](https://svgo.dev/docs/plugins/), and the default plugins in [Preset Default | SVGO Documentation](https://svgo.dev/docs/preset-default/).\n\nSVGO reads the configuration from `svgo.config.mjs` or the `--config path/to/config.mjs` command-line option. Some other parameters can be configured though command-line options too.\n\n**`svgo.config.mjs`**\n\n```js\nexport default {\n  multipass: false, // boolean\n  datauri: 'base64', // 'base64'|'enc'|'unenc'\n  js2svg: {\n    indent: 4, // number\n    pretty: false, // boolean\n  },\n  plugins: [\n    'preset-default', // built-in plugins enabled by default\n    'prefixIds', // enable built-in plugins by name\n\n    // enable built-in plugins with an object to configure plugins\n    {\n      name: 'prefixIds',\n      params: {\n        prefix: 'uwu',\n      },\n    },\n  ],\n};\n```\n\n### Default preset\n\nInstead of configuring SVGO from scratch, you can tweak the default preset to suit your needs by configuring or disabling the respective plugin.\n\n**`svgo.config.mjs`**\n\n```js\nexport default {\n  plugins: [\n    {\n      name: 'preset-default',\n      params: {\n        overrides: {\n          // disable a default plugin\n          cleanupIds: false,\n\n          // customize the params of a default plugin\n          inlineStyles: {\n            onlyMatchedOnce: false,\n          },\n        },\n      },\n    },\n  ],\n};\n```\n\nYou can find a list of the default plugins in the order they run in [Preset Default | SVGO Documentation](https://svgo.dev/docs/preset-default/#plugins-list).\n\n### Custom plugins\n\nYou can also specify custom plugins:\n\n**`svgo.config.mjs`**\n\n```js\nimport importedPlugin from './imported-plugin';\n\nexport default {\n  plugins: [\n    // plugin imported from another JavaScript file\n    importedPlugin,\n\n    // plugin defined inline\n    {\n      name: 'customPlugin',\n      params: {\n        paramName: 'paramValue',\n      },\n      fn: (ast, params, info) =\u003e {},\n    },\n  ],\n};\n```\n\n## API usage\n\nSVGO provides a few low level utilities.\n\n### optimize\n\nThe core of SVGO is `optimize` function.\n\n```js\nimport { optimize } from 'svgo';\n\nconst result = optimize(svgString, {\n  path: 'path-to.svg', // recommended\n  multipass: true, // all other config fields are available here\n});\n\nconst optimizedSvgString = result.data;\n```\n\n### loadConfig\n\nIf you write a tool on top of SVGO you may want to resolve the `svgo.config.mjs` file.\n\n```js\nimport { loadConfig } from 'svgo';\n\nconst config = await loadConfig();\n```\n\nYou can also specify a path and customize the current working directory.\n\n```js\nconst config = await loadConfig(configFile, cwd);\n```\n\n## Donors\n\n| [\u003cimg src=\"https://sheetjs.com/sketch128.png\" width=\"80\"\u003e](https://sheetjs.com/) | [\u003cimg src=\"https://raw.githubusercontent.com/fontello/fontello/8.0.0/fontello-image.svg\" width=\"80\"\u003e](https://fontello.com/) |\n| :------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------: |\n|                       [SheetJS LLC](https://sheetjs.com/)                        |                                              [Fontello](https://fontello.com/)                                               |\n\n## License and Copyright\n\nThis software is released under the terms of the [MIT license](https://github.com/svg/svgo/blob/main/LICENSE).\n\nLogo by [André Castillo](https://github.com/DerianAndre).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvg%2Fsvgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvg%2Fsvgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvg%2Fsvgo/lists"}