{"id":15405136,"url":"https://github.com/fnando/svg_optimizer","last_synced_at":"2025-04-15T16:50:56.079Z","repository":{"id":10137181,"uuid":"12210850","full_name":"fnando/svg_optimizer","owner":"fnando","description":"Some SVG optimization based on Node's SVGO","archived":false,"fork":false,"pushed_at":"2024-01-17T22:59:03.000Z","size":142,"stargazers_count":19,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T00:51:15.763Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"xtuml/bridgepoint","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fnando.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["fnando"],"custom":["https://paypal.me/nandovieira/🍕"]}},"created_at":"2013-08-19T08:12:18.000Z","updated_at":"2024-09-23T03:19:52.000Z","dependencies_parsed_at":"2022-08-31T03:10:53.984Z","dependency_job_id":"a58c29c2-abbc-4304-bea7-7e5ef32cedad","html_url":"https://github.com/fnando/svg_optimizer","commit_stats":{"total_commits":49,"total_committers":5,"mean_commits":9.8,"dds":0.2857142857142857,"last_synced_commit":"b3225455b2e31782ded7d6c35f902fb27f456f3d"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fsvg_optimizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fsvg_optimizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fsvg_optimizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fsvg_optimizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnando","download_url":"https://codeload.github.com/fnando/svg_optimizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249113125,"owners_count":21214835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-01T16:15:10.491Z","updated_at":"2025-04-15T16:50:56.053Z","avatar_url":"https://github.com/fnando.png","language":"Ruby","funding_links":["https://github.com/sponsors/fnando","https://paypal.me/nandovieira/🍕"],"categories":[],"sub_categories":[],"readme":"# SvgOptimizer\n\n[![Tests](https://github.com/fnando/svg_optimizer/workflows/ruby-tests/badge.svg)](https://github.com/fnando/svg_optimizer)\n[![Gem](https://img.shields.io/gem/v/svg_optimizer.svg)](https://rubygems.org/gems/svg_optimizer)\n[![Gem](https://img.shields.io/gem/dt/svg_optimizer.svg)](https://rubygems.org/gems/svg_optimizer)\n\nSome small optimizations for SVG files.\n\n## Installation\n\n```bash\ngem install svg_optimizer\n```\n\nOr add the following line to your project's Gemfile:\n\n```ruby\ngem \"svg_optimizer\"\n```\n\n## Usage\n\n```ruby\n# Optimize an existing String.\nxml = File.read(\"file.svg\")\noptimized = SvgOptimizer.optimize(xml)\n\n# Optimize a file - it will override the original file.\nSvgOptimizer.optimize_file(\"file.svg\")\n\n# Optimize a file - it saves a copy to \"optimized/file.svg\".\nSvgOptimizer.optimize_file(\"file.svg\", \"optimized/file.svg\")\n```\n\nYou may have a need to optimize a *trusted* SVG document with entities that need to be\nexpanded. **Only if you are sure the file is trusted**, you may enable this additional entity\nprocessing by passing the `trusted:` keyword argument:\n\n``` ruby\n# Optimize an existing trusted String which requires entity expansion.\nxml = File.read(\"file.svg\")\noptimized = SvgOptimizer.optimize(xml, trusted: true)\n\n# Optimize a trusted file which requires entity expansion - it will override the original file.\nSvgOptimizer.optimize_file(\"file.svg\", trusted: true)\n```\n\n\nYou can specify the plugins you want to enable. The method signature is:\n\n```ruby\nSvgOptimizer.optimize(xml, plugins)\nSvgOptimizer.optimize_file(input, output, plugins)\n```\n\nwhere `plugins` is an array of classes that implement the following contract:\n\n```ruby\nclass MyPlugin \u003c SvgOptimizer::Plugins::Base\n  def process\n    xml.xpath(\"//comment()\").remove\n  end\nend\n```\n\nThe default list of plugins is stored at `SvgOptimizer::DEFAULT_PLUGINS`. To use\nyour new plugin, just do something like this:\n\n```ruby\nSvgOptimizer.optimize(xml, SvgOptimizer::DEFAULT_PLUGINS + [MyPlugin])\n```\n\n## Maintainer\n\n- [Nando Vieira](https://github.com/fnando)\n\n## Contributors\n\n- https://github.com/fnando/svg_optimizer/contributors\n\n## Contributing\n\nFor more details about how to contribute, please read\nhttps://github.com/fnando/svg_optimizer/blob/main/CONTRIBUTING.md.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](https://opensource.org/licenses/MIT). A copy of the license can be\nfound at https://github.com/fnando/svg_optimizer/blob/main/LICENSE.md.\n\n## Code of Conduct\n\nEveryone interacting in the svg_optimizer project's codebases, issue trackers,\nchat rooms and mailing lists is expected to follow the\n[code of conduct](https://github.com/fnando/svg_optimizer/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Fsvg_optimizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnando%2Fsvg_optimizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Fsvg_optimizer/lists"}